Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script to measure size of a file

Posted By: Martha Hughes     Category: Unix / Linux / Ubuntu     Views: 6577

Write a shell script to measure size of a file.

Code for Shell script to measure size of a file in Unix / Linux / Ubuntu

clear
echo "Enter any file name: "
read filenm
if [ -e $filenm ]
then
    echo $filenm" File exist"if [ -s $filenm ]
    then
        echo $filenm" File has size > 0"else
        rm $filenm
        echo $filenm" File is Deleted which has size = 0"
    fi
else
    echo "File not exist"
fi
  
Share: 


Didn't find what you were looking for? Find more on Shell script to measure size of a file Or get search suggestion and latest updates.

Martha Hughes
Martha Hughes author of Shell script to measure size of a file is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!