[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[50 character or so descriptive subject here (for reference)]
From: |
Mario V Nigrovic |
Subject: |
[50 character or so descriptive subject here (for reference)] |
Date: |
Thu, 17 Jul 2003 17:57:01 -0700 (MST) |
Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.8
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc'
-DCONF_OSTYPE='solaris2.8' -DCONF_MACHTYPE='sparc-sun-solaris2.8'
-DCONF_VENDOR='sun' -DSHELL -DHAVE_CONFIG_H -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -I/media/gnu/bash-2.05
-I/media/gnu/bash-2.05/include -I/media/gnu/bash-2.05/lib
-I/tools/GNU/003/SunOS_5.8/include -g -O2
uname output: SunOS jaguar 5.8 Generic_108528-22 sun4u sparc SUNW,Ultra-60
Machine Type: sparc-sun-solaris2.8
Bash Version: 2.05
Patch Level: 0
Release Status: release
Description:
Constant manipulation of IFS is tedious and can cause grief.
So I suggest a substitution syntax that overrides IFS for the
scope of the expansion.
I'd sure like to see something like
while read line; do
pwdata=( "${line@:}" )
gecos=( "${pwdata[4]@;}" )
# other code goes here
done < /etc/passwd
where the data after the @ gets used to split the quoted word
up into separate words based on the characters that follow.
I think that's just lots clearer than
while read line; do
IFS=:; pwdata=( $line )
IFS=';'; gecos=( ${pwdata[4] )
# other code goes here
done
because, among other things, you don't have to worry about
what's happening to IFS in the larger scope. Constantly
resorting to save_IFS="$IFS" ... IFS="$save_IFS" makes really
cluttered and tortured code.
I have not looked at the code at all, but this seems like a
fairly simple extension of "$@" and "${array[@]}".
An additional use for this syntax might be when expanding
arrays:
"${array[*]@:}"
Thanks,
Mario
- [50 character or so descriptive subject here (for reference)],
Mario V Nigrovic <=