Write a shell script that takes a command -line argument and reports on whether it is directory, a file, or something else. Script: echo " Enter File Name" read str if [ -f $str ] then echo "File exists and it is an ordinary file" elif [ -d $str ] then echo "directory file" else echo "not exists" fi if [ -c $str ] then echo "character device files" fi Output: Enter File Name Samplefile File exists and it is an ordinary file
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter