How to Use Execute Shell Script -- With Input From

Here's a more complicated example:

REF: Find (Search) For Files Using Bash Find [Example]
image

#IFS=$'\n'
{ read myFolderToSearch; read myRootFileName; read myFileExt; }

# --- DEFAULT VALUES If NOT Passed Via stdin ---
myFolderToSearch=${myFolderToSearch:-~/Documents}
myRootFileName=${myRootFileName:-*}
myFileExt=${myFileExt:-*}

myFolderToSearch="${myFolderToSearch/#~/$HOME}"

echo "$myFolderToSearch -- $myRootFileName.$myFileExt"

find "$myFolderToSearch" -maxdepth 1 -name "$myRootFileName.$myFileExt" 

# --->find /Users/jmichaeltx/Documents/Test -maxdepth 1 -name *.jp*g

Builds this command:
find /Users/jmichaeltx/Documents/Test -maxdepth 1 -name *.jp*g

2 Likes