Part 3 Scripts
- Use
pico to edit the .login file and add
aliases for your favourite (?) MS-DOS or VMS commands (eg. dir ls
-l | more, del rm -i).
- Create a new directory called
~/mybin. Edit the .cshrc
file and reset your path shell variable to include this directory (remember
to include $path to ensure you don't lose all the existing
search paths!).
- Create a shell script that counts files you own in the current directory.
Place this shell script in your
mybin directory, change it's
file permission to be executable and use the command, >source
.cshrc
to ask the shell to find this new command before
attempting to run it.
- Create a shell script that reads in 4 parameters (say filenames) from
the command line and prints out a list of all the parameters, the number
of parameters and then echo
The third filename is and the
value of the third parameter. Modify this to print out No parameters
found if there are no parameters found. There is no particular easy
way to count the number of arguments given; one way is to use a for
loop along with a expr expression to count the number elements
in the string (of parameters) $*.
- Write a shell script called, say
addcom, that moves a
file to your ~/mybin directory and changes the file permission
to be executable. Check this command works by creating a simple script
that echoes It works! and then giving it as an argument to
the new outcome command.
- Write a shell script to produce a calendar for this month, whenever
it is used. Build in options for the whole year, or even for a specified
month and year.
- Create a
.logout file. Add commands to remove all *.o
files from a program directory and display your filestore quota.