PLEASE NOTE: the upgrades to this server,, have not yet been completed.
Hopefully the changes will be completed on THURSDAY 8th December.
Web-based programs, such as csmarks, cssubmit, and the help fora, will be unavailable at some time on Thursday 8th.
  It's UWAweek 49


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 564 articles.
Currently 4 other people reading this forum.

 UWA week 18 (1st semester, week 9) ↓
SVG not supported

Login to reply

9:38pm Mon 2nd May, Michael W.

"James Osborne" <23*7*3*[email protected]*u*e*t*u*a*e*u*a*> wrote:
> #!/bin/bash > lines=0 > > for i in file1 ; do > lines=$((lines + 1)) > done > > Can someone explain why my code needs a semicolon in the for loop? I've spent 3 hours researching and literally never heard or saw an example of this being needed.
Hi James, If the "do" was below the "for" there is no need of a semicolon (which is how I set it out in my examples). When it's on the same line it gets confused as to whether the do is actually one of the things the for loop is iterating over. I therefore think it's clearer to have those things above, and the do on the next line. Cheers MichaelW

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy