I am making simple Shell script form some boring-ever-repeating job. Script changes directory correctly, and now I want to run other scripts based on argument I typed when running script. Other scripts are scattered in subdirectories and each one is unique. So I want to insert just file name and let script find out in which subdirectory is that file.
I tried something like this:
filename="default.ini" while [ $# -gt 0 ] do case "$1" in -f) filename="$(find ./ -name $2)"; shift;; -*) echo >&2 \ "usage: $0 [-v] [-f file] [file ...]" exit 1;; *) break;; # terminate while loop esac shift done echo $filename
But, find doesn’t return any result, so it stays
default.ini. Is there other way to solve this?