(UN*X shell programming, test, [:)
The test -s filename tests whether filename exists and has a nonzero size. For instance:
if [ -s $f ]; then
  echo "$f is non-empty!"
fi
with the Bourne shell or a compatible.
(Perl:)
Borrowing from the aforementioned usage in the shell, the test -s filename returns the size of filename, or undef if it does not exist. In particular, if you use it as a test, since 0 is false too, you get precisely the shell's test behaviour:
print "$f is non-empty!\n" if -s $f;

-s.

1. [OE. es, AS. as.]

The suffix used to form the plural of most words; as in roads, elfs, sides, accounts

.

2. [OE. -s, for older -th, AS. -[eth].]

The suffix used to form the third person singular indicative of English verbs; as in the falls, tells, sends.

3.

An adverbial suffix; as in towards, needs, always, -- originally the genitive, possesive, ending. See -'s.

 

© Webster 1913.

Log in or register to write something here or to contact authors.