Find the answer to your Linux question:
Results 1 to 2 of 2
Recently started using linux and been playing around with scripts. I'm trying a for loop but it keeps giving me an error. Basically I'm trying to kill any process that ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2006
    Posts
    1

    for loop????


    Recently started using linux and been playing around with scripts. I'm trying a for loop but it keeps giving me an error. Basically I'm trying to kill any process that is taking up too much of the processing power.

    ps aux | awk '{print $2}' | grep [0-9][0-9].[0-9] > pid.txt
    for process in `cat pid.txt` do
    kill $process
    done


    Error message it gives me:

    ./43: line 4: syntax error near unexpected token `renice'
    ./43: line 4: ` renice +19 $process '

    I've tried so many different things but i don't understand whats wrong.

    Thank you in advance for the help,
    UbuntuNewbie

  2. #2
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    Location
    Holland
    Posts
    301
    I answered you in your _other_ post.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •