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


Click here to return to the 'As an alias...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
As an alias...
Authored by: robg on Jul 29, '02 08:45:06AM
In trying to sort through a similar hint submitted by Kevin B., we were having some trouble making versions of these aliases function on my machine. After much back and forth, Kevin came up with a quoting technique that worked for me. Applied to the above command, it looks like this:
 % alias kdock kill '`'"ps -acx | grep Dock$ | awk '{print "\$1"}'"'`'
If you add this to your alias file, then a simple "kdock" will kill the Dock upon request. -rob.

[ Reply to This | # ]
As an alias...
Authored by: aranor on Jul 29, '02 04:38:38PM
An even better version, which is a slightly modified version of the hint I actually submitted, is the following:
alias kdock kill '`'"ps -xaco pid,command |
  egrep -x '[[:space:]]*[[:digit:]]+ Dock' | awk '{print "\\$1"}'"'`'
(split into 2 lines for easier viewing) This will match only the dock and nothing else, whereas the other 2 methods could match something that's just similarly named.

[ Reply to This | # ]
As an alias...
Authored by: aranor on Jul 29, '02 04:40:43PM
Gah! The dreaded slashes bug strikes again! The preview made it look correct, but the submission had an extra slash. I'll attempt to post the code again. If it doesn't work, just remember that it's supposed to be one slash before the $1.
alias kdock kill '`'"ps -xaco pid,command |
  egrep -x '[[:space:]]*[[:digit:]]+ Dock' | awk '{print "\$1"}'"'`'
(split into 2 lines for easier viewing)

[ Reply to This | # ]