Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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