[Vm-dev] with: do: in (ba)sh scripts
gettimothy
gettimothy at zoho.com
Fri Jun 13 19:23:45 UTC 2014
Hi Eliot.
Below is a draft. I will tighten it up to verify it works using your example names.
I am guessing you have stuff in pdir=( "Newspeak Spur Virtual Machine" "Newspeak Virtual Machine" ) that you want to copy over to ddir=(newspeak.cog.spur newspeak.cog.v3 )
What we can do is iterate over pdir array and index ddir element as such.
#!/bin/bash -x
#define a function that handles the copy from p to d
do_p_dir_stuff(){
cp $0/* $1/
}
#create arrays of what you want to iterate over and an array index
pdir=( "Newspeak Spur Virtual Machine" "Newspeak Virtual Machine" )
ddir=(newspeak.cog.spur newspeak.cog.v3 )
arrayindex=0
#create your iterator
for p in "${pdir[@]}"
do
do_p_dir_stuff $p $arrayindex
$arrayindex = $arrayindex+1
done
exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140613/e03176b3/attachment.htm
More information about the Vm-dev
mailing list