A short bash script below lists all the files and directories in this directory and its sub. What does $1/*the script mean ? Please give me some recommendations on this. Thanks
$1/*
#!/bin/sh list_alldir(){ for file in $1/* do if [ -d $file ]; then echo $file list_alldir $file else echo $file fi done } if [ $# -gt 0 ]; then list_alldir "$1" else list_alldir "." fi
This is the glob of the first argument, considered as a directory
bash script $0 ( script), $1, $2, $3... To , , . $* $@. ($* , $@ , $IFS)
$0
$1
$2
$3
$*
$@
$IFS
$1 .for file in $1/* loop file, , .
for file in $1/*
file
$1 - . . /asdf.sh a b c d e, $1 , $2 b .. $1 ..