Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with vi script

Status
Not open for further replies.

fonrob

Technical User
Sep 24, 2010
1
US
I am new to vi I found this script but can not get it to work. I created the directory under my id then created a file

#!/bin/sh
############################################################
PS=/bin/ps
CUT=/usr/bin/cut
SORT=/usr/bin/sort
HEAD=/usr/bin/head

if [ -x $PS -a -x $CUT -a -x $SORT -a -x $HEAD ]
then
echo
echo " %CPU PID TIME VSZ USER COMMAND"
echo
$PS -aef -o pcpu= -o pid= -o time= -o vsz= -o user= -o args= |
$CUT -c -130 | $SORT -r | $HEAD -10
else
exit 1
fi


==========================================================
This is what i get

$ stat
stat: =/bin/ps: not found
$ pwd
/home/frober01/test


here is the ls command
$ ls -ltr
total 8
-rwx------ 1 frober01 staff 337 Sep 24 14:39 stat
$
can anyone help
 
You will to make sure that you have the correct path for "ps". Do a "which ps" and that will confirm the path. Do the same for the other 3 commands. From their update the script and retry.

Mike


WarpZero Technologies
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top