20141118 looping over an array in bash - plembo/onemoretech GitHub Wiki

title: Looping over an array in bash link: https://onemoretech.wordpress.com/2014/11/18/looping-over-an-array-in-bash/ author: phil2nc description: post_id: 8835 created: 2014/11/18 12:48:16 created_gmt: 2014/11/18 17:48:16 comment_status: closed post_name: looping-over-an-array-in-bash status: publish post_type: post

Looping over an array in bash

Just an example for the kids. [code lang="bash" gutter="false"] #!/bin/bash # Set special permissions on Laravel v4 app # Run this as root VOL=/nfsq APPNAMES=(currentweb newweb testweb) echo date echo "Setting special perms on app (Laravel v4)" for APPNAME in ${APPNAMES[@]}; do APPDIR=${VOL}/www/html/${APPNAME} 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 done [/code] NOTE: Thanks WordPress for mangling the presentation of my code to the point that the syntax was completely screwed up!

Copyright 2004-2019 Phil Lembo