How to write this condition in ksh?
if myfile is empty or myfile does not exist
then
do action1
fi
is this OK?
if [[ -s "$myfile" ]] -o [[ -f "$myfile" ]] then
then
do action1
fi
Thanks.
How to write this condition in ksh?
if myfile is empty or myfile does not exist
then
do action1
fi
is this OK?
if [[ -s "$myfile" ]] -o [[ -f "$myfile" ]] then
then
do action1
fi
Thanks.
if [[ -s "$myfile" -o -f "$myfile" ]] ; then
#do action1
fi
Look at man test.
vino
Actually this did not work on HP-UX
However replacing the -o with || works
[[ cond1 || cond2 ]]
why is ksh so strange???
From man ksh
[[ expression ]]
Similar to the test and [ ... ] commands (described later), with
the following exceptions:
o Field splitting and file name generation are not per-
formed on arguments.
o The -a (and) and -o (or) operators are replaced with &&
and ||, respectively.