Skip to content

Instantly share code, notes, and snippets.

@quickgrid
Created April 1, 2016 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quickgrid/d74ef26d08ffb242dd0a95a6ad2bc9a9 to your computer and use it in GitHub Desktop.
Save quickgrid/d74ef26d08ffb242dd0a95a6ad2bc9a9 to your computer and use it in GitHub Desktop.
Example of argument passing to a function.
#!/bin/bash
#Recursively traverse the directories
traverseDirectory(){
for fileName in `ls $1/`
do
if [ -d $1/$fileName ]; then
echo "$1/$fileName"
traverseDirectory "$1/$fileName"
#rm -rf $1/$fileName
fi
done
}
var='deletefolder'
traverseDirectory $var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment