|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
multiple if conditions and EOF in a shell script
I want to create an IF condition with multiple condition, in the statement below I want to add OR EOF, can any one please advise how to do. Code:
if [ ${array[5]} != $sample ] && [ $c -eq 1 ]; then
echo .....
fi
Last edited by jim mcnamara; 04-13-2012 at 05:15 PM.. Reason: code tags |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
#!/bin/bash
if [[ "${array[5]}" != "$sample" && $c -eq 1 ]]; then
# do stuff here
fiuse [[ and ]] always put quotes around string variables or empty variables can generate errors that stop the script. EOF: this is sort of the standard way to read file in straight shell and write the output to a file Code:
while [[ read variable_name && $farkle="something" ]] do # stuff goes here echo "something you want to see in the output file" done < /path/to/inputfile > /path/to/outputfile you can also exit a loop early with the break keyword Last edited by jim mcnamara; 04-13-2012 at 05:45 PM.. Reason: forgot EOF |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| specifying multiple conditions in AWK | skyineyes | Shell Programming and Scripting | 2 | 05-12-2010 10:31 AM |
| Help regarding multiple conditions | ssenthilkumar | Shell Programming and Scripting | 4 | 01-08-2010 02:10 AM |
| How to Use Multiple if Conditions in Shell script | dinesh1985 | Shell Programming and Scripting | 5 | 06-25-2009 11:10 AM |
| multiple if conditions | bashshadow1979 | Shell Programming and Scripting | 4 | 04-21-2009 03:08 PM |
| multiple conditions in if/then | grandtheftander | UNIX for Dummies Questions & Answers | 4 | 07-21-2006 01:58 PM |
|
|