Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 08 Jul 2012 17:47:25 +0100
From:      Vincent Hoffman <vince@unsane.co.uk>
To:        "FreeBSD-Questions@freebsd.org" <FreeBSD-Questions@freebsd.org>
Subject:   for loops with /bin/sh on command line.
Message-ID:  <4FF9B99D.4010101@unsane.co.uk>

next in thread | raw e-mail | index | archive | help
I'm sure I'm being dim, but why cant I do a for loop on the command line
using /bin/sh ?
am I suffering from too much use of bash and as such shouldnt expect it
to work?


banshee# for foo in 1 2 3 ; do echo $foo ; done
for: Command not found.
foo: Undefined variable.
banshee# echo 'for foo in 1 2 3; do echo $foo ; done' > bahh.sh
banshee# sh bahh.sh
1
2
3
banshee#



Vince



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FF9B99D.4010101>