Thorsten Glaser wrote:

> Bela Lubkin dixit:
>
> >   ${@-/dev/stdin}    POSIX shell syntax for "This script's arguments,
> >                      or if none, /dev/stdin (standard input)"
>
> You want "${@:-/dev/stdin}" with the double quotes and the colon.
> (Yes, that's POSIX.)

I agree about the quotes.  Fortunately the script in question is part of
a `man` back-end and will never actually see filenames with spaces.

I would argue that "-" is correct here, not ":-".  That is, the commands
`lynx2ascii` and `lynx2ascii ""` *should* behave differently.  Lynx's
behavior for a blank argument is to output nothing, not to consume
stdin.  That behavior seems more likely to conform to the expectations
of a script invoking this script; if it truly intends to process stdin
then it should pass no arguments.

(Looking at it another way: the missing quotes are an outright error;
"-" vs. ":-" is a question of intent, and as the author, I _intend_ my
script to behave differently for no-args vs. "empty arg".)

>Bela<

_______________________________________________
Lynx-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lynx-dev

Reply via email to