Here's the end result I am trying to:
I have over 15 users of an cloned instance of my application, sometimes I need to update files (they pretty much all stay the same--everything is dynamic. This is for updates/new features). I wrote a pretty simple bash script that I had to manually put each user from /home/ into the array. But I need this to scale.
How can I take a directory listing (something like a LS command) feed ONLY DIRECTORY names into then a bash array. Likely i'll want this command in the bash file though, because I'll want it to grab all users in the /home/ directory, push into the array (eg: webUsers( adam john jack )
Here's a snapshot of what my current script looks like (non-dynamic user listing)
webUsers( adam john jack )
for i in "${webUsers[@]}"
do
cp /home/mainSource/public_html/templates/_top.tpl /home/$i/public_html/templates
done
How do I achieve this?