Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
google site



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

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-10-2010
Registered User
 

Join Date: Feb 2010
Posts: 110
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: 5,591
Thanks: 2
Thanked 68 Times in 65 Posts

Code:
IP=${SSH_CLIENT%% *}

  #3  
Old 03-10-2010
Registered User
 

Join Date: Feb 2010
Posts: 110
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: 5,591
Thanks: 2
Thanked 68 Times in 65 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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


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 07:51 AM.