Re: string split, bash and IFS

2008-09-05 Thread Jim Hertzler
#!/bin/bash # Split the command line argument on the colon character. SaveIFS=$IFS IFS=":" declare -a Array=($*) IFS=SaveIFS echo "Array[0]=${Array[0]}" echo "Array[1]=${Array[1]}" echo "Array[2]=${Array[2]}" echo "Array[3]=${Array[3]}" Unga wrote: > > Hi all > > How to use bash and IFS to s

Re: string split, bash and IFS

2008-09-05 Thread Jim Hertzler
Go to: http://www.linuxquestions.org/questions/programming-9/bash-shell-script-split-array-383848/?posted=1#post3270996 And see: IP=1.2.3.4; IP=(${IP//./ }); Rev=${IP[3]}.${IP[2]}.${IP[1]}.${IP[0]} Unga wrote: > > Hi all > > How to use bash and IFS to split a string? > > eg. > $string = "Nam