![]() |
|
|
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 |
| Problem with variable expension using for loop. | ejdv | Shell Programming and Scripting | 2 | 06-16-2008 11:15 AM |
| while read loop w/ a nested if statement - doesn't treat each entry individually | littlefrog | Shell Programming and Scripting | 7 | 12-11-2007 09:49 PM |
| For loop statement - catch error | lumdev | Shell Programming and Scripting | 4 | 09-20-2007 08:50 AM |
| if statement in a while loop | bobo | UNIX for Dummies Questions & Answers | 2 | 11-07-2006 12:38 PM |
| if statement in for loop of a string | Sniper Pixie | UNIX for Dummies Questions & Answers | 7 | 03-02-2006 07:28 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi,
Again a little problem. Do not understand good why an empty string is not detected. Here is the program: #!/bin/ksh APR=`date | grep Apr | awk '{print $2$3}'` MAY=`date | grep May | awk '{print $2$3}'` JUN=`date | grep Jun | awk '{print $2$3}'` echo "Variable Apr has value: $APR" echo "Variable May has value: $MAY" echo "Variable Jun has value: $JUN" echo for ITEM in $APR $MAY $JUN do if [[ "${ITEM}" = "" ]] then echo "The checked item has no value." else echo "The checked item has value ${ITEM}" fi done Output: Variable Apr has value: Variable May has value: Variable Jun has value: Jun17 The checked item has value Jun17 I expected it a little different. Maybe this is an issue: # echo $MAY | od -c 0000000 \n 0000001 Thanks in advance, ejdv |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|