CMPSCI 197J: HW3

1. Distinguish the functionality of the  two commands                                      (5 points)
          1. nice mycommand& ; nohup  mycommand&
         nice will run mycommand in the background with low priority.
          nohup will allow my command to continue running in the background after you have logged off.

          2. at -f test 1530 ; batch test
          Using the at command, the commands in file test will be executed at time 1530.
          The batch command will   run the commands  in test whenever it is possible (i.e the system load is not too high.) 
 

2.                                                                                                                             (5 points)
Arrange for a list of all your files (including 'dot' files) and directories to be mailed to you every weekday at 6p.m.
crontab -e maildir
00 18 * * 1,2,3,4,5 ls -a | mailx araja

3.                                                                                                                              (5 points)
Copy the contents of your current directory to /tmp/backup preserving all links.(You cannot use the cp command!)
$  pax -w . >/tmp/backup.pax
 

4.                                                                                                                               (5 points)
Write a script which will request you for two numbers, representing width and height of a rectangle in cm, and output the area of the rectangle both in square metres and square inches(1 inch = 2.54cm)
$echo Input ht and width
$read N1 N2
INM=$( echo "($N1 *  $N2)/10000" | bc )
M1=$ (echo "$N1/2.54" | bc )
M2=$ (echo "$N2/2.54" | bc )
ININ= $ (echo "$M1 * $M2  | bc )
echo AREA in square metres is $INM
echo AREA in square inches is $ININ

5.                                                                                                                                (5 points)
Ensure that PATH is set; if it is not reset it to /bin:/usr/bin, and inform the user of its value.
$echo The PATH is {$PATH:="/bin:/usr/bin"}