--a2FkP9tdjPU2nyhF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, 14 Sep 2001 at 07:03:19 -0400, David T-G wrote:
> % ---BEGIN---
> % #!/bin/sh
> ...
> % pgp $* 2>$PGP_ERR 1>$PGP_OUT
>=20
> BTW, you might want to modify your script to protect any arguments with
> embedded spaces.  Change the line above to
>=20
>   pgp ${1+"$@"} 2>$PGP_ERR 1>$PGP_OUT
>=20
> and you're golden.

It's much more straightforward to use:

        pgp "$@" [...]

actually. :)

> [BTW, I haven't *yet* found this in any shell documentation since I
> saw it in a shell programming tip; can anyone provide me a pointer for
> further research?]

I daresay you haven't been looking hard enough. :)

Quoting FreeBSD's "man sh" [from the listing of special parameters]:
|   @       Expands to the positional parameters, starting from one.
|           When the expansion occurs within double-quotes, each
|           positional parameter expands as a separate argument.  If
|           there are no positional parameters, the expansion of @
|           generates zero arguments, even when @ is double-quoted.
|           What this basically means, for example, is if $1 is ``abc''
|           and $2 is ``def ghi'', then "$@" expands to the two
|           arguments:
|                 "abc"   "def ghi"

As for further research, i generally got by on the sh and bash manpages
up till now.  They're generally very concentrated in terms of info, and
take a while to sink in.  I find myself realizing new things all the
time when i'm (re-)reading them. :-)

(Prominent example: just now while writing this mail, i saw for the
first time how ${1+"$@"} works.  Ingenious approach, even if a bit
redundant.  Most probably in the context of the tip you found it in it
was a workaround for a shell that didn't handle a plain "$@" correctly?)

--=20
Piet Delport <[EMAIL PROTECTED]>
Today's subliminal thought is:

--a2FkP9tdjPU2nyhF
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)

iD8DBQE7pB2mzRUP82sZFCcRAvCVAJ4jzkyFEmALLlEhocnWHQAvXxm4qgCffPxJ
tpv05IQHXabtYMM1jKfdM6c=
=3Ffj
-----END PGP SIGNATURE-----

--a2FkP9tdjPU2nyhF--

Reply via email to