![]() |
|
|
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 |
| If statement (yes or no) | bobo | UNIX for Dummies Questions & Answers | 7 | 10-21-2008 03:46 PM |
| If statement - How to write a null statement | april | Shell Programming and Scripting | 3 | 04-16-2008 02:14 PM |
| What does this statement mean? | Legend986 | High Level Programming | 1 | 11-17-2007 02:48 AM |
| if Statement... | cengiz | Shell Programming and Scripting | 6 | 07-13-2005 07:55 AM |
| Another question on awk - Begin statement | eff_cee | Shell Programming and Scripting | 5 | 03-10-2005 01:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
IF statement question
Hi there
We have boxes named server-sybase2, server-oracle1, etc etc Does any body know how I can construct an if statement to say, if the hostname of the box contains the string "sybase" then do X ie Code:
if [ `hostname` contains the string "sybase"] then X fi |
|
||||
|
if [ `hostname | grep sybase > /dev/null 2>&1; echo $?` -eq 0 ]
then do_sybase_stuff fi f [ `hostname | grep oracle > /dev/null 2>&1; echo $?` -eq 0 ] then do_oracle_stuff fi f [ `hostname | egrep "oracle|sybase" > /dev/null 2>&1; echo $?` -eq 0 ] then do_ommon_oracle-sybase_stuff fi |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|