Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Win shell cmd equivalent under bash

9 views
Skip to first unread message

Jurai

unread,
Jan 19, 2013, 12:48:49 PM1/19/13
to
Hi. Could someone show me how to perform the equivalent of the
following Windows shell command -> for /R %b in (*) do chdman copy -i
%~pnxb -o
\temp%~pnb <- under bash? Basically I need the bash equivalent of the
Windows 'for' command. TIA.
-- Jurai

Java Jive

unread,
Jan 19, 2013, 1:54:09 PM1/19/13
to
On Sat, 19 Jan 2013 10:48:49 -0700, Jurai <Jurai@WhereTheHellAmI.???>
wrote:

> Hi. Could someone show me how to perform the equivalent of the
> following Windows shell command ->
> for /R %b in (*) do chdman copy -i %~pnxb -o \temp%~pnb
> <- under bash?

Not knowing what chdman does, no. It's not a Windows cmd shell
command that I know of.

See below for the basic for loop in bash, though.

> Basically I need the bash equivalent of the
> Windows 'for' command. TIA.

That is easy:
http://www.gnu.org/software/bash/manual/bashref.html#Looping-Constructs

eg:

for ITEM in # An expression giving a list;
do
# Something
# Eg:
echo "This is item: $ITEM"
done
--
=========================================================
Please always reply to ng as the email in this post's
header does not exist. Or use a contact address at:
http://www.macfh.co.uk/JavaJive/JavaJive.html
http://www.macfh.co.uk/Macfarlane/Macfarlane.html

Cecil Westerhof

unread,
Jan 19, 2013, 3:04:14 PM1/19/13
to
Op zaterdag 19 jan 2013 19:54 CET schreef Java Jive:

> for ITEM in # An expression giving a list;
> do
> # Something
> # Eg:
> echo "This is item: $ITEM"
> done

I would not use an all caps variable as loop variable. All caps
variables are normally used for read-only variables.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

unruh

unread,
Jan 19, 2013, 5:21:07 PM1/19/13
to
for

for i in *
do
command
...
list
...
done


Or
for ((i=0;i<956;i++))
do
ls test$i
done



man bash


> -- Jurai
0 new messages