1753384 Members
5815 Online
108792 Solutions
New Discussion юеВ

if [ ! -s file.aa ]

 
SOLVED
Go to solution
Carme Torca
Super Advisor

if [ ! -s file.aa ]

Does anyone could help me and say me what does is the significate of this line ?
if [ ! -s file.aa ]
Thanks a lot of!
Carmen.

#/bin/ksh
touch file.aa
if [ ! -s file.aa ]
then
codi2=999
fi
Users are not too bad ;-)
3 REPLIES 3
Steven E. Protter
Exalted Contributor
Solution

Re: if [ ! -s file.aa ]

The code in the if fi loop should execute if the file exists and is greater than zero bytes in size.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rob Fisher
Advisor

Re: if [ ! -s file.aa ]

The -s file.aa is checking to see if "file.aa" has a non-zero length.

The ! is the negate.

So, this is checking to see if file "file.aa" has a zero length, or is empty.
May the winds of life keep you on the right tack
Steven E. Protter
Exalted Contributor

Re: if [ ! -s file.aa ]

Missed the explanation point. My original post is wrong.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com