• Source
    1. #
    2. #Write a script to display the directory in the descending order of the size of each file.
    3. #
    4. clear
    5. echo -n "Enter name of the directory :"
    6. read directory
    7.  
    8. if [ ! -d $directory ]
    9. then
    10. echo "Directory not exist"
    11. else
    12. for i in $(ls -Sl $directory | tr -s " " | cut -d " " -f8)
    13. do
    14. echo $i
    15. done
    16. fi