Suppose my shell script gets 3 arguments:./myscript dir1 material dir2I need $# to report the count of items globbed with dir1/* and not the count of my script's original 3 arguments.Do you know any way I might apply this code?
globbing and $#
shell script;wildcards;arguments
for  argdo   set -- $arg/*     [ -e $1 ]  &&     printf '%s/*:\t%d\n'  $arg $#doneif you should like to keep your original args following the execution of such a loop:argc=$#for  argdo   set -- $arg/* $@     [ -e $1 ]  &&     printf '%s/*:\t%d\n' $arg $((${#}-argc))     shift $((${#}-argc))done