Hi,
I would like to run following code in bash inside a zsh script. (In this case is output unfortunately very different if you run it in zsh).
I tried to put "bash" in front of the code but I obtained following error message "bash: do: No such file or directory
" eve though I merged the whole code into one line.
Could anyone help?
bases=`echo A T G C`
for c1 in $bases
do
for c2 in $bases
do
for c3 in $bases
do
echo $c1$c2$c3
done
done
done
your script should work just fine with bash , ksh , or zsh . And, if you use the much simpler and more efficient:
bases="A T G C"
or:
bases='A T G C'
your script should work just fine with any shell based on Bourne shell syntax (such as ash , bash , ksh , zsh , or on almost any UNIX or Linux system /bin/sh .
I apologize. I don't use zsh . I had assumed that it was rejecting the old form of command substitution, but zsh (at least on OS X) does not seem to perform field splitting as required by the standards on the unquoted expansion of a variable. Do you have to use zsh for your script instead of running the entire script with bash or ksh ?
zsh is more user friendly for me, so I usually use it. This command should be a minor part of another zsh script.
The other suggesteg solution works, so I'm OK
bash -c 'b="A T G C"; for c1 in $b;do for c2 in $b;do for c3 in $b; do echo $c1$c2$c3;done;done;done'