NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Fixing up that shell command (Score:1)
You had
ps -ef|grep "$user.*$app_name"|grep -v grep|sed -e 's/"//g' -e 's/.* script//'If you're using all GNU tools, you can improve that shell command a bit:
ps --no-header --user "$user" --format command | grep "^$app_name" | sed 's/"//g;s/.* script//'If you require shortest-possible shell commands, you can use the short-format switches on ps and trim whitespace:
ps h -u "$user" -o command|grep "^$app_name"|sed 's/"//g;s/.* script//'Reply to This
Re: (Score:2)
We're on Solaris. Many tools and options I took for granted on *nix systems simply aren't available. For example, the ps command does recognize the --no-header or --user options.
Other annoyances: tar doesn't recognize the z modifier and the absolute worst: grep doesn't recognize -r. No recursive grep. The options are either doing a find and piping the results to grep or using ack [cpan.org] (the latter of which is lovely, I might add).
Re: (Score:2)
Some admins get their panties in a bunch over the fact that GNU tar is not POSIX compliant, but most people shrug and decided they'd rather have something useful over some notion of correct, especially when Sun's tar can't handle paths over 256 characters.
That may be specifically relevent to you as a Catalyst user given this thread [google.com] from comp.unix.solaris.
Re: (Score:1)
can't you simply install some packages? sunfreeware.com is a good place.
Anyway my point was: don't forget /proc and magic
ps ;) perl -lpe 's{\0}{ }g' /proc/*/cmdline
cheers --stephan p.d at least if you have a decent support for it always worth to remember.