Monday, April 11, 2011

Bash-it to pieces!

So after moving around in the Cygwin and having moved around and learning to script in perl in Linux I am getting really good with moving around using the terminal and am currently working on a script to re-name files as part of a tutorial.


#first check for the various 'modes' that this program has
             #if the first ($1) condition matches then we execute 
             #that portion of the
             #program and then exit
             
             # check for the prefix condition
             if [ $1 = p ]; then
             
             #we now get rid of the mode ($1) variable and prefix ($2)
               prefix=$2 ; shift ; shift
             
             # a quick check to see if any files were given
             # if none then its better not to do anything than rename 
             # some non-existent
             # files!!
             
               if [$1 = ]; then
                  echo "no files given"
                  exit 0
               fi

No comments:

Post a Comment