Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Solaris / SysV Style ps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Solaris / SysV Style ps
Authored by: ikioi on Apr 27, '06 08:46:38PM
This is a great hint! I've missed Solaris style ps too. Here's a slight tweak to your script that makes it even more usable. Take the following and save it as ~/bin/ps , and the you can run "ps -ef" with the space between the "ps" and the "-ef". (Don't forget to do a hash -r so that bash will find the new ps in ~/bin/ .)

#!/bin/bash
#echo hi
pformat="user=UID,pid,ppid,cpu=C,start=STIME,tty,time,command"
psarglist=
psarglistlong=
args="`echo \"$*\" | /usr/bin/sed -e 's/-ef$//' -e 's/-ef/-/'`"
set -- $args
#echo "$args"
#set $args
while true ; do
	if [ -z "$1" ]; then
		break;
	fi
	optchar=${1:1}
	case $optchar in
		O|o|p|t|U)
			shift
			psarglistlong="$psarglistlong -$optchar $1"
		;;
		*)
			psarglist="$psarglist$optchar"
		;;
	esac
	shift
done
/bin/ps -ax$psarglist $psarglistlong -o $pformat


[ Reply to This | # ]