Shell Script To Provide ls -l in output in customized format

in Categories Academic, Decision Making, File-management last updated October 20, 2008

Share this on:

3 comment

  1. Hi
    there is a problem with your script
    when you execute it , if there is any file or directory which it’s name contains ” ” ( i mean space ) , you would get some error.
    to deal this error you should modify all your if clause to :
    if [ -f “$f” ]
    another note is that , we expect a “ls” comand to accept an argument as a path , for example : ls /etc/ —> should list all the files and directories in /etc/.
    to deal this i suggest you to modify these lines :
    cd “$1” ##this line is added between the 2 lines you had##
    for f in *
    echo “Total size of regular files : $totsize”
    cd “-” > /dev/null ## and this line is added at the end of script##
    thnx for your nice ideas in scripting

    Best Regards , H.Noroozi

  2. nixcraft site is absolutely such a helpful site to me.
    its very user friendly especially to those who are newbie in linux like me.
    easy to understand and gives a good example. thanks to nixcraft!!

    Have a question? Post it on our forum!