Skip to content

Instantly share code, notes, and snippets.

@mitchwongho
Last active August 29, 2015 14:22
Show Gist options
  • Save mitchwongho/81202230b15bcc8d2503 to your computer and use it in GitHub Desktop.
Save mitchwongho/81202230b15bcc8d2503 to your computer and use it in GitHub Desktop.
Bash tricks

find file in decendants and assign to a variable as an array

$ paths=( $(find . -regex '.*/AndroidManifest.xml') )

reference paths elements

$ echo ${paths[0]} # element 0
$ echo ${paths[1]} # element 1
$ echo ${paths[@]} # flatmap

iterate array path

for element in "${paths[@]}";
do
   echo "$element";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment