[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] Transferring page text from lynx to vim

From: Bela Lubkin
Subject: Re: [Lynx-dev] Transferring page text from lynx to vim
Date: Mon, 3 Oct 2011 09:50:16 -0700

Thorsten Glaser wrote:

> Bela Lubkin dixit:
> >   address@hidden/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".)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]