swapnil
swapnil

Reputation: 77

unix condition checking!

what condition is being checked below?

if [[ ! -s ${FILE} || -z ${FILE} ]]

(here $FILE is a data file)

Upvotes: 0

Views: 1041

Answers (2)

S.P
S.P

Reputation: 8756

! -s ${FILE} 

checks if file exists and is not empty

-z ${FILE}

checks if the FILE string length is zero

Upvotes: 1

Michiel Buddingh
Michiel Buddingh

Reputation: 5919

See the manpage for test(1). $FILE either does not exist, has zero size, or is an empty string.

Upvotes: 2

Related Questions