bash - Problem checking if a file in a loop is a directory -
this code working example of checking if path directory:
if [ -d "$1" ]; printf "directory exists\n" else printf "does not exists\n" fi
i changed try , test if files in directory directories or not:
for file in "$1/*"; if [ -d "$file" ]; printf "directory: %s\n" $file else printf "file: %s\n" $file fi done
but not work - directories displayed if files. why wont work? , how can code want?
cheers.
you can't quote asterisk.
for file in "$1"/* ;
Comments
Post a Comment