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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -