Write a shell script to print the names of all files in the current working directory in alphabetical order using for loop

Write a shell script to print the names of all files in the current working directory in alphabetical order using for loop

Code:

clear
echo -------------------------------------------------------
echo '\t file Names in current working directory'
echo -------------------------------------------------------

for File in *
do
        if [ -f $File ]
        then
                echo $File
        fi
done

Output:

No comments

Powered by Blogger.