Looping over an array in bash

Just an example for the kids.

# Set special permissions on Laravel v4 app
# Run this as root
APPNAMES=(currentweb newweb testweb)
echo `date`
echo "Setting special perms on app (Laravel v4)"
for APPNAME in ${APPNAMES[@]};
   echo ${APPDIR}
   chown -R apache:webdev ${APPDIR}/app/storage
   chmod -R ug+rw ${APPDIR}/app/storage
   chown -R apache:gctech ${APPDIR}/public/img
   chmod -R ug+rw ${APPDIR}/public/img

NOTE: Thanks WordPress for mangling the presentation of my code to the point that the syntax was completely screwed up!

This entry was posted in Development, System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).