|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
file size check
How can I perform size check of any character file(which switch)?
For example: I have to perform certain actions if file size is not zero. How can I do that? Is this syntax fine? if test ! -z $filename then fi |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
-z $filename checks whether the string contained in the variable $filename is of length zero or not. If you understand string functions in c/c++, -z $filename is the same is as the function if (strlen(filename) == 0) To check whether the file has a size greater than 0, use the construct Code:
[ -s "$filename" ] vino |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Thanks for your help vino.
malay |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| check the file size | sandy1028 | Shell Programming and Scripting | 1 | 11-11-2010 06:16 AM |
| Check the file size - help | sithara | Shell Programming and Scripting | 5 | 06-10-2010 10:52 AM |
| Check for file size is zero or not. | Hangman2 | Shell Programming and Scripting | 3 | 04-14-2009 04:08 PM |
| How to check the file size in a dir | bsathishmca | Shell Programming and Scripting | 6 | 10-02-2008 10:26 AM |
| Check file size | alnita | UNIX for Dummies Questions & Answers | 6 | 06-20-2005 02:34 PM |
|
|