![]() |
|
|
grep unix.com with google
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Our Members | 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. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
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). |
|
|||
|
It appeared to be different shell versions. The was a bug in the older one. Upgrading the shell fixed it. Thanks!
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
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 03:39 AM |
| Extracting a field value from a line | Naresh Akkal | Shell Programming and Scripting | 5 | 05-06-2009 04: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 01:42 AM |