![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What's wrong with this line: if ${TEST:?} ; then echo empty; fi | meili100 | UNIX for Dummies Questions & Answers | 2 | 02-23-2008 07:45 AM |
| existing file to a fixed length file | cmanand | Shell Programming and Scripting | 3 | 01-25-2008 01:50 PM |
| Creating a csv file based on Existing file | skywayterrace | Shell Programming and Scripting | 3 | 12-02-2007 05:19 AM |
| how to add files to an existing tar file - HP-UNIX | Nomaad | UNIX for Dummies Questions & Answers | 4 | 06-16-2006 03:44 PM |
| i want to delete a file based on existing file in a directory | srivsn | Shell Programming and Scripting | 3 | 04-11-2006 01:38 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
if test for empty and non-existing file
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. |
| Forum Sponsor | ||
|
|
|
||||
|
From man ksh
Code:
[[ 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.
|
||||
| Google The UNIX and Linux Forums |