[SlugBug] Using cut in bash scripts

Bill Best bill at commedia.org.uk
Thu Apr 6 19:09:39 BST 2006


hi there

just quickly, i would like to extract the process number of the icecast 
service running here and then give it a variable name:

> [root at machine ~] ps aux | grep icecast
> iceadmin  9862  0.0  3.4 339200 17796 pts/126 S   16:04   0:00 icecast -c /etc/icecast.xml
> root     10061  0.0  0.1  4444  592 pts/126  R    16:13   0:00 grep icecast

this is very wrong but might explain what i want the script to do:

ps aux | grep icecast | cut -f2 > /tmp/icecastproc.$$

i've tried using cut on the number of characters but no joy as yet.

i am writing this script to quickly stop and then restart an icecast 
server after the config file has been changed.

any ideas?  many thanks in advance and best regards

bill



More information about the SlugBug mailing list