3

I'm not sure if I'm asking that right, but here is the script:

#!/bin/sh
# foundation-setup.sh --- Gets the latest Zurb Foundation release
if test $1
then  
    mkdir $* 
    cd $* 
    wget -q http://foundation.zurb.com/cdn/releases/foundation-latest.zip
    unzip -q foundation-latest.zip
    rm foundation-latest.zip
else     
       echo 'Missing directory Argument!'
fi

When I run this with ./foundation-setup.sh a b c, it works but it only unzips to the first directory argument. I think it has something to do with the cd $* . By the way I'm new to Linux and Bash.

5

If you want to extract the downloaded zip in each of the three directories the middle part of the script should be:

mkdir -- "$@" || exit 
wget -q http://foundation.zurb.com/cdn/releases/foundation-latest.zip &&
  for d do
     (
       cd -- "$d" &&
         unzip -q ../foundation-latest.zip
     )
  done &&
  rm foundation-latest.zip

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.