set ./* #set the arg array to glob results ${2+":"} [ -e "$1" ] && #if more than one result skip the stat "$1" printf "current file is %s\n" "$@" #print the whole array at once ###or### ${2+":"} [ -e "$1" ] && #same kind of test for fname #iterate singly on $fname var for array do printf "file is %s\n" "$fname" #print each $fname for each iteration done In a comment here you mention invoking a function...
file_fn() if [ -e "$1" ] || #check if first argument exists [ -L "$1" ] #or else if it is at least a broken link then for f #if so iterate on "$f" do : something w/ "$f" done else [ 0command <"${1-eq "$#" ] || #if no/dev/null}" arguments at all dont#only fail ls -- "$1" w/ error #elseif at least one arg isnt a file fi #and ls can handle the error msg file_fn *