Understanding a Shell Script

Hi Guys,
I am absolutely a newbie to Solaris 8.0. Following is a piece of code in a script (/bin/sh). Can anybody help me in deciphering this ? Please see my questions after the script code -

_____________________________________________________

/bin/rm -f mycron
crontab -l | grep -v "transferring to a system" | grep -v "Auto deletion of transmitted objects" | grep -v "Dealing with not importable" > mycron

fixpart="/etc/usr/transfer_script  # transferring to a system"
  echo "Specify the frequency in minutes - "
  echo "every 1, 2, 3, or 5 minutes (default every 1 minute) "
  echo  $nn "Frequency [1|2|3|5] ? [1]:" $cc
  read ans
  case $ans in
    2) echo "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59 * * * *" $fixpart >> mycron
       break ;;
    3) echo "1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58 * * * *" $fixpart >> mycron
       break ;;
    5) echo "1,6,11,16,21,26,31,36,41,46,51,56 * * * *" $fixpart >> mycron
       break ;;
    *) echo "* * * * *" $fixpart >> mycron;;
  esac

_____________________________________________________

  1. The crontab part above ?? :eek:
  2. What does this mean fixpart="/etc/usr/transfer_script # Auto ...."
  3. What is the significance of the variable $fixpart. I did not understand the usage.
    :confused:

Basically, can someone explain me this script ?

Thx in advance !

crontab -l lists all the cron jobs scheduled and grep -v is used not to print the line where the string is present.

The 2nd one its a variable nothing else .

You are assiging a fixpart variable

It is used to echo

Hi amit,
What does this mean
fixpart="/etc/usr/transfer_script # transferring to a system"

There is a "#" before a string and the entire file path and the string are in a quote.

while assigning a variable if it is within " " the shell will consider it a whole . So here its a single string
"/etc/usr/transfer_script # transferring to a system"

fixpart="/etc/usr/transfer_script # transferring to a system"

The fixpart is a variable which is being assigned the value,

/etc/usr/transfer_script # transferring to a system

What the script does is it is adds an entry for the transfer_script to the mycron file with the desired frequency of execution.

Hi Shan,
That makes sense. Thanks. So now we have these two lines,

crontab -l | grep -v "transferring to a system" | grep -v "Auto deletion of transmitted objects" | grep -v "Dealing with not importable" > mycron
fixpart="/etc/usr/transfer_script # transferring to a system"

The only common thing is the text "transferring to a system". Does this mean that mycron consists of a job named "transferring to a system" which is executed by the transfer_script file ?