Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Error with for loop...

    Could anybody tell me where the error is and why its not being recognised:

    ps aux | awk '{print $3}' | grep [0-9][0-9].[0-9] > pid.txt

    for process in `cat pid.txt` do
    renice +19 $process

    The error being produced is:

    syntax error near unexpected roken 'renice'

    Thank you.

  2. #2
    A few people have viewed the thread and not responded, if there is any need for clarification on the question at hand, then please feel free to ask... This is fairly urgent and any input would be greatly appreciated...

  3. #3
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    The 'do' statement in the next line or break the line with ';'

    for var in list


    for var in list; do something;done

    and more combinations

    Brest regards

  4. $spacer_open
  5. #4
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Hi, fernape.

    I noticed this over at as well. I think we are being asked to solve homework problems. I don't know how to detect these with certainty, but some common traits seem to be the relative simplicity of the problem, no background provided, no indication of what has been tried, and a low posting count.

    If these are homework problems, then the students are putting in more work posting them compared to the effort they would expend by trying to solve them.

    In some of these, I attempt the Socratic method by asking questions, such as "is the for ... do sequence an entire statement?", hoping that real problem-solvers will at least try something ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  6. #5
    'drl' - there is a rule in regards to asking for answers to homework questions however having spoken to one of the moderators earlier, he explained to me how asking information on a particular topic - 'for loops' in this instance, was perfectly alright... Also fernape hasn't given me any 'answers' he's simply highlighted that I might be missing a ';' in my script and displayed the correct syntax of a for loop...

    You are a Newbie also and forums like these are there for provide help, not answers, whether that be for homework or personal, so in future keep your unwanted opinions and comments to yourself... It may take you a whole day to post a question on a forum, but it took me less than 5 mins... which is hardly spending more time posting for answers then working on the answer myself.


  7. #6
    BTW fernape, thanx heaps for your help...

  8. #7
    whether that be for homework or personal, so in future keep your unwanted opinions and comments to yourself
    How did we ever manage to learn anything in school before the internet?
    We actually read our school books and/or went to the library (do those even still exist?) ... with a new school levy a year on the ballot - please tell me you still have school issued books?

    In those lovely books you could find your answers, if you were not so impatient and lazy.

    I know i will look more closely at the questions being asked in this forum before i reply ... I am not helping anybody with their homework.

  9. #8
    Linux User IsaacKuo's Avatar
    Join Date
    Feb 2005
    Baton Rouge, LA, USA
    Quote Originally Posted by TBD
    I know i will look more closely at the questions being asked in this forum before i reply ... I am not helping anybody with their homework.
    Don't worry about that. You won't be. Any student who thinks he's getting ahead by having someone else answer the question for him is in for a big shock come exam time.
    Isaac Kuo, ICQ 29055726 or Yahoo mechdan

  10. #9
    TBD, do you honestly think that the first port of call is the internet for student these days? Evidently your living in what strange warped world, if you think I havn't looked up my error in the textbook or searched for articles on the internet - as I was doing this, I stumbled across a forum... and thought why not get some advise from people who obvious have sort of knowledge on something I am struggling with.

    Personally I don't see anything wrong with that and by the looks of it, this forum is extremely well moderated and non of the admins/moderators had a problem with this particular post, what is your problem?

    Have I asked you specifically for the answer to my question? Did I even post up my question? What did I ask for? Some sort of idea, where I am going wrong... NOT an answer... which part of that can't you fathom?

    If you are interpreting my posts as a plea for answers you are hugely mistaken, as I said, if you have nothing constructive to say... Please refrain from doing so... I don't want to spend my time waisted on numbskulls like yourself, I'd rather discuss what this forum is solely for and by knowledge that is Linux, not your petty opinions... take them where someone gives a rats arse... or shove them where the sun doesn't shine...

  11. #10
    'IsaacKuo' could you please point out where I asked for an answer to my problem?

    I asked for: 'any input which could help me understand why I might be getting the error' mentioned in my initial post.

Posting Permissions

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