Shell Script를 이용하여 파일/디렉토리 구분

by JOHN

IT
random_image

ls -l /Users/program/ | while read line

do

    echo "$line"

    if [[ $line = d* ]]; then

        echo "It's a directory."


    elif [[ $line = -* ]]; then

        echo "It's a file."


    else

        echo "It's a garbage."

    fi


done


2
Leave a Comment:
Search