Thursday, April 28, 2016

SHELL Scripting

Example1:

#/bin/bash

a=''
case $@ in
        testfile) for user in $(cat $1);do
                echo "Adding user:" $user
                useradd -s /bin/false $user
                done
                ;;
        $a) echo "Usage: /root/createusers"
                ;;
        *) echo "Input File Not Found"

esac


Example2:

#!/bin/bash
case $@ in
postconf)
         echo "postroll"
         ;;
postroll)
         echo "postconf"
         ;;
*)
         echo "/root/random postconf|postroll"
         ;;
esac

Example3:

#/bin/bash

for (( counter=100; counter>1; counter-- ));do
        echo $counter
done
exit 0

1 comment:

  1. I appeared in my Juniper exam after preparation from Pass4sure Juniper dumps. I passed it at the first attempt with my desired grades as was guaranteed. I didn’t seek help from any other material because Juniper exam material gave me full understanding of the syllabus. Dumpspass4sure should be chosen as guide for every IT student.

    ReplyDelete