Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm a student, and I have a hard time completing this term assignment, if anyone could help me I would appreciate it very much. I did my best to do it but the output is not good. I use Win2000 Command prompt to connect via Telnet to Unix server at my college.
For this assignment, I need to do the following:
_____________________________________________
1. Create a SHELL SCRIPT within your HOME DIRECTORY called ABScript that will:
- Display the script name
- Display all users currently logged onto the system
- Display how many users are currently on the system (ie. add up the logged in users)2. Create SHELL SCRIPT within your HOME DIRECTORY called CDScript that will:
- Display the script name
- Display the active processes
- Start the Bourne Shell3. Create SHELL SCRIPT within your HOME DIRECTORY called EFScript that will:
- Display the script name
- Display the active processes
- Display a message that you are now calling up the KORN Shell
- Call up the KORN Shell
- Display the active processes
- Display that you are going to terminate the KORN Shell
- Terminate the KORN Shell
- Display the active processes4. Create a SHELL SCRIPT within your HOME DIRECTORY called BIGScript that will:
- Display the script name
- Execute ABScript, CDScript, EFScript
- Display "END OF RUN"_______________________________________________________________________________________________
This is how I did it (but the output doesn't satisfy):
1st Script: echo "ABScript"
who -H
who -q2nd: echo "CDScript"
ps
sh3rd: echo "EFScript"
ps
echo "Now calling up the Korn Shell..."
ksh
ps
echo "Now terminating the Korn Shell..."
kill4th: echo "BIGScript"
ABScript
CDScript
EFScript
echo "END OF RUN"

OK. Honesty gets you big points here.
-----8-----cut here----8-----
#!/bin/sh
echo $0
cnt=`who | wc -l | awk '{ print $1 }'`
who -H
echo "$cnt users currently logged in"
-----8-----cut here----8-----
#!/bin/sh
echo $0
ps -ef
( pwd ; ls -1 ; date )
-----8-----cut here----8-----
Hope this helps.

cat EFscript
#!/bin/sh
KSH=`which ksh`
echo "#!$KSH" > korn.sh
cat > korn.sh
echo "Starting KORN shell spawned process"
set | grep -i shell=
ps -ef
echo "Ending KORN shell spawned process"
EOT
chmod ugo+rx korn.sh
. ./korn.sh
ps -ef

I don't want to put you down or anything, but I am not sure I beleive you that you "tried" Did you evel look on google ?
Anyway, here is the code for the first one anyways. I hope it will get you started.
________________________________________
#!/bin/sh
who
echo " the num of us .... is: `who | wc -l`"
echo $0_________________________________________
line 1 starts the shell
line 2 displays all users logged in
line 3 the "| wc -l" (L) takes the output from
wc -l (which counts the "words") and
makes it the input for who.
therefore you get the number of users
line 4 prints the first thing you typed on
the command line (ie the name of the
script)

![]() |
prevent a file from being...
|
Encrypted password 64 cha...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |