![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [: =: unary operator expected | bhag281 | UNIX for Dummies Questions & Answers | 7 | 03-10-2009 09:47 AM |
| unary operator expected | Satyak | Shell Programming and Scripting | 2 | 03-06-2009 02:56 PM |
| awk returning "[: ==: unary operator expected" | theamrit | Shell Programming and Scripting | 2 | 11-03-2008 01:51 PM |
| unary operator expected error | ssuresh1999 | UNIX for Dummies Questions & Answers | 2 | 10-28-2008 09:33 PM |
| Binary operator expected | basisvasis | Shell Programming and Scripting | 4 | 09-26-2008 04:33 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
unary operator expected
Im trying to fix my /etc/weekly that rotates various logs however it does them no matter what filesize they are and i want them to only do it if there file size exceeds 2M or something. So I'm playing with a script to get the filesize using a ls -l command which works and puts the value into a variable.
So then i hope to test that variable with if -gt but it doesn't work, maybe because its the wrong data type not sure really. Here is the code I'm playing with Code:
ls -l asl.log| awk '{printf "%s",$5}'
max=300
if [ $5 -gt $max ]; then echo "wohoo";
else echo "grr";
fi
I have checked the result of Code:
ls -l asl.log| awk '{printf "%s",$5}'
Quote:
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|