The UNIX and Linux Forums  


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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-15-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,794

Code:
IFS=:
echo "$string1" | read arr1[1] arr1[2] arr1[3]
echo "$string2" | read arr2[1] arr2[2] arr2[3]
IFS=" "

Or use the bash initializer

Code:
arr1=( `echo "$string1" | tr -s ':' ' '` )