Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-10-2010
Registered User
 

Join Date: Feb 2010
Posts: 123
Thanks: 2
Thanked 1 Time in 1 Post
Put output into an array

I'm trying to take the output of an environment that has multiple strings

ex.

Code:
# echo $SSH_CLIENT
192.168.1.1 57039 22

I need that IP... so I can set it to another environment.

Thank you
Sponsored Links
    #2  
Old 03-10-2010
Moderator
 

Join Date: Feb 2007
Location: The Netherlands
Posts: 7,287
Thanks: 55
Thanked 427 Times in 408 Posts

Code:
IP=${SSH_CLIENT%% *}

Sponsored Links
    #3  
Old 03-10-2010
Registered User
 

Join Date: Feb 2010
Posts: 123
Thanks: 2
Thanked 1 Time in 1 Post
Thank you Franklin52.

Is there any way I could have a break down on why that works so I may better understand it?
    #4  
Old 03-10-2010
Moderator
 

Join Date: Feb 2007
Location: The Netherlands
Posts: 7,287
Thanks: 55
Thanked 427 Times in 408 Posts
Quote:
Originally Posted by adelsin View Post
Thank you Franklin52.

Is there any way I could have a break down on why that works so I may better understand it?
Have a read of this:

Learning the Korn Shell, 2nd Edition: Chapter 4: Basic Shell Programming

Regards
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
C system() how to send the output to an array?? Jess83 Programming 5 01-20-2010 03:50 AM
Creating an Array in KSH from output (stdout) carlos25 Shell Programming and Scripting 2 09-25-2008 12:45 AM
bash:awk output into an array phamp008 Shell Programming and Scripting 2 03-16-2008 04:14 AM
move output of awk to array amitrajvarma Shell Programming and Scripting 14 12-21-2007 05:12 AM
output of an array ragha81 Shell Programming and Scripting 3 03-22-2007 03:30 PM



All times are GMT -4. The time now is 12:55 AM.