The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
perl-like split function for bash?
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
perl-like split function for bash?
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
09-05-2008
Jim Hertzler
Registered User
Join Date: Sep 2008
Posts: 2
#!/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]}"
Jim Hertzler
View Public Profile
Find all posts by Jim Hertzler
Find Jim Hertzler's past nominations received
Find Jim Hertzler's present nominations given