Slash Boxes
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • 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//'

    • No grep for user (which may be output numerically under some conditions)
    • --no-header and --format mean you get only what you want out of ps
    • No grep -v to remove grep
    • No -e on the sed commands
    • Combined the sed commands into a single sed exp
    • 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 [] (the latter of which is lovely, I might add).

      • Many Solaris admins replace the default tar with GNU tar, perhaps installing it as gtar, giving users their choice.

        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 [] from comp.unix.solaris.