![]() |
|
|
|
|
|||||||
| 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 |
| check if remote file exists | hcclnoodles | Shell Programming and Scripting | 2 | 08-27-2008 02:53 PM |
| Need to write a script in UNIX to find a file if another file exists | mmdawg | Shell Programming and Scripting | 1 | 05-04-2008 07:40 PM |
| Check File Exists and compare to previous day file script | rbknisely | Shell Programming and Scripting | 3 | 02-07-2008 08:53 AM |
| Need Script to check whether user exists in the remote machine | Srini75 | SCO | 1 | 09-07-2005 08:23 AM |
| file exists and size greater that zero | methos | Shell Programming and Scripting | 3 | 03-25-2002 10:44 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
compile time error when i execute this code
Hi all,
Please tell me to solve this issue, ROTATE_FILES=" <PATH>" REAL_FILE="MQ.log" function rotate_files() { for j in $1;do echo "Loop1" if [ -d $j ] then for i in `ls -a /$j` do if [ $i = MQ.log ] then echo $i FILESIZE=`ls -l $i|awk '{print $5}'` #......error......# LIMIT=0 if [ $FILESIZE -ge 0 ] #......error......# then echo "the size is greater" fi fi done fi done } rotate_files "$ROTATE_FILES" ----------------------------------------------------------------- FILESIZE=`ls -l $i|awk '{print $5}'` "ls: MQ.log: No such file or directory" <<<error message if [ $FILESIZE -ge 0 ] "[: -ge: unary operator expected" <<<error message please tell me how to solve this |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
Try providing full path instead of relative path
Quote:
Thanks Nagarajan G |
|
#10
|
|||
|
|||
|
Quote:
check if [[ ! -f $i ]];then only check the size. |
|||
| Google The UNIX and Linux Forums |