Need Help in Writing Unix Shell scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tvbhkishore
    New Member
    • Nov 2007
    • 1

    Need Help in Writing Unix Shell scripts

    Hi all,

    I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


    Thanks & Regards,
    Kishore
  • arne
    Recognized Expert Contributor
    • Oct 2006
    • 315

    #2
    Originally posted by tvbhkishore
    Hi all,

    I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


    Thanks & Regards,
    Kishore
    I liked the Advanced Bash Scripting Guide .

    HTH,
    arne

    Comment

    • rajarora
      New Member
      • Sep 2007
      • 33

      #3
      Originally posted by tvbhkishore
      Hi all,

      I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


      Thanks & Regards,
      Kishore
      -------------------------
      Hi Kishor,

      In order to have a starting on shell programming, you can try it with following link:

      http://gd.tuwien.ac.at/linuxcommand.or g/wss0010.html

      It will gives you enough confidance for writing your own scripts too.Once you get it on then for details of shell script programming you can try the following link:-
      http://www.esscc.uq.ed u.au/~ksteube/Bshell/

      Hope that gives you some fruitful results,

      Regards,
      Raj Kumar Arora

      Comment

      • nassim
        New Member
        • Dec 2007
        • 4

        #4
        Originally posted by tvbhkishore
        Hi all,

        I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


        Thanks & Regards,
        Kishore
        don't forget that there are hundreds of shell scripts on your computer now: make search for shell scripts

        i can email you a few simple beginner examples that i have done.

        Comment

        • nassim
          New Member
          • Dec 2007
          • 4

          #5
          Originally posted by nassim
          don't forget that there are hundreds of shell scripts on your computer now: make search for shell scripts

          i can email you a few simple beginner examples that i have done.
          here's a bourne script that copies a file:


          #!/bin/sh
          trap 'echo "script ex3 interrupted"; exit' 2 #user of system kills script

          # control number of arguments typed after command
          # command is name of shell script file, which has to be executable
          # ie chmod +x filename

          if [ $# -ne 2 ]
          then
          echo "two arguments expected"
          exit 1
          fi

          allowcopy=no; from=$1; to=$2

          if [ -e $from ] # if file exists
          then
          if [ -e $to ]
          then
          answer=notgiven
          while [ $answer = notgiven ]
          do
          echo " " $to " exists. replace? "
          read wish # input from keyboard
          case $wish in
          y|Y)
          answer=given
          allowcopy=yes
          ;;
          n|N)
          answer=given
          exit
          ;;
          *)
          echo "y or n please"
          ;;
          esac
          done
          else
          #the from file exists, the to file doesn't. copy from to
          allowcopy=yes
          fi
          else
          # the 'from' file doesn't exist. nothing to copy.
          echo file $from " not found. exiting."
          exit 1
          fi

          if [ $allowcopy=yes ]
          then
          cp $from $to
          fi

          a few useful things in this bash. hope it helps

          Comment

          Working...