The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Problem adding into an array field!!! talk2pawee Shell Programming and Scripting 5 06-11-2009 02:39 AM
Extracting a field value from a line Naresh Akkal Shell Programming and Scripting 5 05-06-2009 03:51 AM
Extracting Field values for XML file junaid.nehvi High Level Programming 3 03-27-2009 12:38 PM
Perl - if conditions is meet, push the last field of $_ into an array popeye Shell Programming and Scripting 1 12-10-2008 02:16 PM
extracting a field from directory path ?????? skyineyes Shell Programming and Scripting 15 07-10-2007 12:42 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 6 Days Ago
montana24 montana24 is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 4
Extracting field from array

I have a problem with the following lines of code:
Code:
        SaveIFS=$IFS
        IFS="/"
        declare -a Array=($1)#take unix path, split by '/'
        website=${Array[4]} #stores website name
The confusing part is that it works on one machine, but not on the other.

If the code is moved to another machine, I get empty string instead of website (the path is identical on both machines).
  #2 (permalink)  
Old 6 Days Ago
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,910
Are you using the same shell on both machines?
  #3 (permalink)  
Old 3 Days Ago
montana24 montana24 is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 4
It appeared to be different shell versions. The was a bug in the older one. Upgrading the shell fixed it. Thanks!
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On




All times are GMT -4. The time now is 10:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0