![]() |
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 |
| How to giv two conditions in IF statement..?? | RRVARMA | Shell Programming and Scripting | 6 | 04-25-2008 09:33 AM |
| problem with if, while, for conditions | kittusri9 | Shell Programming and Scripting | 3 | 04-24-2008 09:15 AM |
| reduce the or conditions | hitmansilentass | Shell Programming and Scripting | 8 | 05-03-2007 05:27 PM |
| multiple conditions in if/then | grandtheftander | UNIX for Dummies Questions & Answers | 4 | 07-21-2006 01:58 PM |
| if statement with two conditions | cin2000 | Shell Programming and Scripting | 1 | 01-23-2006 03:21 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
if statement with two conditions -e, &&
Wow I'm so zoned out I don't even know if I posted this question up already (I couldn't find it in my book marks or in "yesterday's" post).
My question is, I'm writing a korn script that does something like the following, but I don't yet completely understand the syntax. I need to check that the first field equals a string and that the second string equals a space. This isn't working -- is it right or wrong? PHP Code:
|
|
||||
|
apologies
Ah yes, of course. Let me type out the larger picture so you can see how it's working.
The ls.txt is a cut listing of filenames (one filename per line). As I'm opening each file, which happen to be all fixed-length csv files, I'm cutting the first field and the fifth field. The following would be an example of two records (each line in each fixed-length csv file is a record with aproximately 32 fields). I have isolated the two fields for you. Example fields (the forum deletes extra spaces so it would be easier I think if I describe it instead: FIELD1 is in columns 2-4 (a string of 3 letters), and the the second column aka FIELD5 can either be filled with a one digit number (1-9) or a single space (" "). PHP Code:
Last edited by yongho; 06-14-2005 at 10:29 AM.. |
|
||||
|
HrrmMm..
Question: I just started learning shell scripting a few days ago and I was under the assumption that you didn't need to typeset anything.
One of my previous counters looked like this (in a while statement, not an if statement: var1=`expr $var1 + $var2` ..and it worked. But when I tried the expr command in the if statement, it didn't increment at all. Would you know why this is? Could it be because once you enter an if statement, you must use different rules? Last edited by yongho; 06-14-2005 at 10:54 AM.. |
|
||||
|
i think you're on to something..
Quote:
Here's the big picture. PHP Code:
edit: Hmm.... You know what, let me work on this for another hour and come back and tell you if it's still broken. Last edited by yongho; 06-14-2005 at 02:54 PM.. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|