Skip to content

Instantly share code, notes, and snippets.

@hiyosi
Created April 17, 2018 06:55
Show Gist options
  • Save hiyosi/40478d624f406c91407b875653fe8816 to your computer and use it in GitHub Desktop.
Save hiyosi/40478d624f406c91407b875653fe8816 to your computer and use it in GitHub Desktop.
#!/bin/bash
a=(
'sudo echo ${foo}'
'sudo ls -l'
'ls -l | sudo echo ${foo}'
)
foo="hello"
for ((i = 0; i < ${#a[@]}; i++))
do
echo $(eval echo ${a[$i]})
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment