Quote:
Originally posted by ls1429
Yeah thatz it.
One more thing. But I am not clear why the ; after condition is really needed or not
Take an easier example, the
date and
who commands. If we want to run both commands, we might use two lines:
date
who
or we can enter both commands on a single line if we use the semicolon like this:
date ; who
But we gotta have something separating the two commands. Usually we have the newline character as the delimiter between commands, but the semicolon also works.
So it's a matter of style whether you use
if [ ... ] ; then
or
if [ ... ]
then
I like the first style because it lets more of the script be visible on a page. But I wouldn't call the second style "wrong".