On Sun, Mar 04, 2001 at 04:32:45AM -0000, john smith wrote: > 1. my script doesn't seem to display the script name together with > whoami..actually, what the script was supposed to do is when it is invoked, > it will display the user name together with the scriptname should the > scriptname gets changed somehow..it displays the username but not the > scriptname itself.
$1 is the first argument passed to the script. The script's name is $0. > 2. how do I add to this script the count of the number of lines in a file? > i.e. let's say cat's man page. `wc -l` counts the number of lines in a file (or passed on stdin). > 3.lastly,let's say I want to print the first line of each 3-char.h file in > /usr/include/lib..how can I accomplish this? `head -1` displays the first line of a file. To select your files, use shell globs - * matches 0 or more characters, ? matches any single character. Check the man pages for wc and head also; they can do some pretty neat (well, maybe not all that neat - but very useful) stuff when passed other arguments. -- SGI products are used to create the 'Bugs' that entertain us in theatres and at home. - SGI job posting Geek Code 3.1: GCS d? s+: a- C++ UL++$ P++>+++ L+++>++++ E- W--(++) N+ o+ !K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r y+