🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Soren Lundsgaard Wed, 27 Sep 1989 14:48
bugs in command line.
#637
Author: Soren Lundsgaard
Date: Wed, 27 Sep 1989 14:48
16 lines
832 bytes
There is one bug report which I submitted which is still
outstanding:  ${1+"$@"} is not expanded correctly if there is a
word with a space in it.

also, the following command works in other shells but not in bash

sed 's/   */\
/g' oldfile

The \-newline pair dissapears.  (In csh, using \\-newline works.)

my apologies to the list readers if these have already been fixed.

Thank you again to bfox, for the neat shell.

skl.
Re: bugs in command line.
#639
Author: Chet Ramey
Date: Wed, 27 Sep 1989 16:24
29 lines
1862 bytes
In article <8909271448.AA28013@abel.math.uiuc.edu> skl@ABEL.MATH.UIUC.EDU (Soren Lundsgaard) writes:
>There is one bug report which I submitted which is still
>outstanding:  ${1+"$@"} is not expanded correctly if there is a
>word with a space in it.

Quoting from the SunOS 4.0 sh man page, which is derived from that of Sys 5
release 3.1:

"Blank Interpretation

After parameter and command substitution, the results of substitution are
scanned for internal field separator characters (those found in IFS) and
split into distinct arguments where such characters are found.  Explicit
null arguments ("" or '') are retained.  Implicit null arguments (those
resulting from parameters that have no values) are removed."

This sounds pretty much like what bash is doing.  If you want to preserve
quotes, quote the whole thing ("${1+$@}").

I don't have a copy of the POSIX 1003.2 spec (the defining document for
bash), but I assume it was derived from the System V Release 3 sh man page
(or at least that man page was used as a reference for this behavior).

Chet Ramey
-- 
Chet Ramey			"We are preparing to think about contemplating 
Network Services Group, CWRU	 preliminary work on plans to develop a
chet@cwjcc.INS.CWRU.Edu		 schedule for producing the 10th Edition of 
				 the Unix Programmers Manual." -- Andrew Hume
${1+"$@"} (was: Re: bugs in command line.)
#642
Author: Maarten Litmaath
Date: Wed, 27 Sep 1989 20:35
33 lines
2028 bytes
chet@cwns1.CWRU.EDU (Chet Ramey) writes:
\In article <8909271448.AA28013@abel.math.uiuc.edu> skl@ABEL.MATH.UIUC.EDU
\(Soren Lundsgaard) writes:
\>There is one bug report which I submitted which is still
\>outstanding:  ${1+"$@"} is not expanded correctly if there is a
\>word with a space in it.
\
\Quoting from the SunOS 4.0 sh man page, which is derived from that of Sys 5
\release 3.1:
\
\"Blank Interpretation
\
\After parameter and command substitution, the results of substitution are
\scanned for internal field separator characters (those found in IFS) and
\split into distinct arguments where such characters are found.  Explicit
\null arguments ("" or '') are retained.  Implicit null arguments (those
\resulting from parameters that have no values) are removed."
\
\This sounds pretty much like what bash is doing.  If you want to preserve
\quotes, quote the whole thing ("${1+$@}").

Sorry Chet, I guess you're wrong here: if I say "$@", do you want the strings
to be broken up into whitespace-separated words?
A quite rhetorical question.
Furthermore "${1+$@}" is completely equivalent to "$@"!
(Think about it before you follow up!)
The classic Bourne shell didn't handle this correctly, so we had to use a
trick to circumvent it: ${1+"$@"}.
I guess bash has got "$@" fixed, but the `trick' must still work as always,
else tons of shell scripts must be fixed.
-- 
 `I AM NEW HEAR AMD I WANT TO INKRIMENT A |Maarten Litmaath @ VU Amsterdam:
 VURIABLE BY 1 (OONE) IN "c"'  (Tom Neff) |maart@cs.vu.nl, mcvax!botter!maart
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads