Some time ago while i was searching for a way to find out what i can delete from my Android rom without crippling functions i use, i found deptree over at the xda forums. Since this was written back in 2012 it wouldn't work as intended. Updating used tools (dex2jar, smali, ...) plus some minor changes to the scripts (like changing folders to the ones used in Android by now, for example system/app-private to system/priv-app/*/) and i got it running again.Part of the magic happens in three scripts which are similar to this one:  while [ -n $1 ]; do    for bin in $1/*; do        [ -f $bin ] || continue        case $bin in            *.so)            ;;            *)            [ -x $bin ] || continue            ;;        esac        $FILE_DIR/perls/parse_bin.pl $bin dbi:SQLite:dbname=$ACTIVE_DB/test.sqlite 2>>$ACTIVE_DB/logs/parse_bin.log    doneshiftdoneThrough using my superpowers of having never learned to code, i concluded following things to happen here (you may correct me if i got something wrong):  while accessing the input folder $1,every bin(ary) file getschecked if it really is a binaryfile, if so,( i have no idea what the ||stands for)it checks for the extension (.soor none) anduses the file(s) found (*.so and the ones without extension) as input for the script parse_bin.plThe input folder has to be super specific, as for this script these are$ACTIVE_DB/rom/system/lib $ACTIVE_DB/rom/system/lib/*/ $ACTIVE_DB/rom/system/usr/lib you get how this continues, super long list of foldersWhat i'd like to know, how would i have to modify these three scripts so that the input folder is $ACTIVE_DB/rom/system? EDIT: The mechanism of finding the file(s) in the input folder(s) is the same in all three scripts except that the other two are searching for *.jar and *.apk EDIT2: The bash shell gets used to run thisI know this has to happen somewhere in the first two lines of the script, i already tried fromnaboos answer from over here which would spit out every binary inside the folder $ACTIVE_DB/rom but would not pass them as input to parse_bin.pl.Please have a log:+ PARSE_BIN DB_45763/rom/system+ '[' -n DB_45763/rom/system ']'+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/CSCVersion.txt ']'+ case $bin in+ '[' -x DB_45763/rom/system/CSCVersion.txt ']'+ printf 'DB_45763/rom/system/CSCVersion.txt:\t'+ echo DB_45763/rom/system/CSCVersion.txt+ ./files/perls/parse_bin.pl DB_45763/rom/system/CSCVersion.txt dbi:SQLite:dbname=DB_45763/test.sqlite+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/app ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/bin ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/build.prop ']'+ case $bin in+ '[' -x DB_45763/rom/system/build.prop ']'+ printf 'DB_45763/rom/system/build.prop:\t'+ echo DB_45763/rom/system/build.prop+ ./files/perls/parse_bin.pl DB_45763/rom/system/build.prop dbi:SQLite:dbname=DB_45763/test.sqlite+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/cameradata ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/csc ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/csc_contents ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/etc ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/fonts ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/framework ']'+ continue+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/kern_sec_info ']'+ case $bin in+ '[' -x DB_45763/rom/system/kern_sec_info ']'+ printf 'DB_45763/rom/system/kern_sec_info:\t'+ echo DB_45763/rom/system/kern_sec_info+ ./files/perls/parse_bin.pl DB_45763/rom/system/kern_sec_info dbi:SQLite:dbname=DB_45763/test.sqlite+ for bin in '$1/*'+ '[' -f DB_45763/rom/system/lib ']'+ continue+ shift+ '[' -n '' ']'
Less specific input for script
bash;scripting;input
Firstly your assumption of what the script does seems correct. It looks at all the files, folders, symlinks etc that it finds in $1, if its a file, then it drills down deeper to determine if its a library or an executable.  In shell scripting $1 is the first argument passed to the script, so to run this script with $ACTIVE_DB/rom/system in the position of $1 you would simply invoke the script with./scriptname $ACTIVE_DB/rom/systemNote: If you are calling this from a command prompt $ACTIVE will have to be substituted for the actual path.In order to make this script descend recursively into your target directory you could try adding this to your scriptwhile [ -n $1 ]; do    # use globbing to descend into all subdirectories    for bin in $(find $1 | tr '\n' ' '); do    # change this  ^^^^           [ -f $bin ] || continue        # leave the rest of the script as is        # ....