![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [csh] How to capture output from a command and pass it on to a variable? | machinogodzilla | Shell Programming and Scripting | 3 | 05-11-2008 06:36 AM |
| How to pass option with "at" command? | bd9439 | UNIX for Dummies Questions & Answers | 3 | 03-24-2008 01:45 PM |
| pass each elements in array to ssytem command | jaganadh | Shell Programming and Scripting | 0 | 12-14-2007 03:57 AM |
| can I pass awk variable to system command? | zhynxn | Shell Programming and Scripting | 2 | 07-05-2006 08:11 AM |
| pf not working properly even with only "pass in all" and "pass out all" rules | xyyz | UNIX for Advanced & Expert Users | 4 | 12-30-2003 02:33 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Pass hotname from command
I have a problem, which is,
I have servers as $hostname : Serverxxd $hostname : Serverxxs $hostname : Serverxxl $hostname : Serverxxp d=dev, s=sit, l=stg, p=prd The packages will be in all the boxes and my script contains $ENV which I should be getting from 'hostname' I am not able to determine how I could look for the last letter in hostname and use it in script to call the ENV variable. Please help/advise Thanks Chiru |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
One way --
Code:
lastletter=$(expr substr $hostname $(expr length $hostname) 1) |
|
#3
|
|||
|
|||
|
Thankyou..it worked !!!
|
|
#4
|
|||
|
|||
|
question
Glenn,
I got a small question. How do you assign variable value with : here. What's the significance here. Quote:
Please let me know |
|
#5
|
||||
|
||||
|
I think the original poster was just defining in non-programming terms what the $hostname variable could be. I don't believe the ":" has any significance beyond that.
|
||||
| Google The UNIX and Linux Forums |