Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14430 > unrolled thread
| Started by | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| First post | 2018-08-01 09:03 -0400 |
| Last post | 2018-08-01 09:03 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Unquoted array slice ${a[@]:0} expands to just one word if IFS doesn't have a space Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-01 09:03 -0400
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2018-08-01 09:03 -0400 |
| Subject | Re: Unquoted array slice ${a[@]:0} expands to just one word if IFS doesn't have a space |
| Message-ID | <mailman.4549.1533128642.1292.bug-bash@gnu.org> |
On Wed, Aug 01, 2018 at 07:42:30PM +0700, pepa65 wrote: > On 08/01/2018 07:12 PM, Greg Wooledge wrote: > > This just reinforces the point that unquoted $@ or $* (or the array > > equivalent) is a bug in the script. It gives unpredictable results. > > If the results are unpredictable, isn't that a bug that wants fixing? > That would be a very noble goal, should it not be possible? Maybe, but for a script writer, it's already too late. Unless you fast forward 20-30 years into the future when EVERY shell has had these bugs fixed for long enough that you can be reasonably confident that your script will not be executed by one of the older shell versions. Isn't it simpler just not to write buggy scripts in the first place? "$@" expands to a list of words, and "$*" expands to a single string with an optional single-character delimiter inserted between substrings. Those are the only two options you've got. What's the intent of a script that uses unquoted $@ or $*? What did the script's author think was going to happen? If it's one of the two cases above, then the missing quotes are simply a bug in the script. If it's something else, then I'd be interested in hearing it. I don't speak for Chet on any of these issues. He may feel an obligation to fix bash if he perceives the behavior as a bug. That's independent of whether a script writer should actually USE such syntax.
Back to top | Article view | gnu.bash.bug
csiph-web