Return to Snippet

Revision: 66218
at March 29, 2014 09:29 by jlmarks

Initial Code
#!/usr/bin/env bash

#this script calls for three variables to be passed to it, a directory, an indent amount, and a file for output. 

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
script_name=$(basename "$0")

new_indent="$indent    " #this increases the indent amount for the next recursion
new_start_dir="$start_dir/$directoryname" #this sets the next directory
$("$path_to_script" "$new_start_dir" "$new_indent" "$outfile") #this actually calls the same 
                                                               #script with the updated parameters

Initial URL

Initial Description
This snippet determines the path and script name that will need to be called, and then calls that script and passes it parameters.

Initial Title
recursively call bash script from any directory

Initial Tags

Initial Language