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

OT: `...` v. $(...) (was: wget and captcha puzzle !!!)



Tony Baldwin wrote:
> John Hasler wrote:
> > Bob writes:
> > > This should enable the separate wget invocations to appear as a single
> > > session client to the remote web site.
> > 
> > But he'll still have to solve the captcha to establish the session.

Yes.  But J said he had that part working okay and without any other
conflicting information I will take him at his word.  :-)

> Indeed.
> Isn't the whole point of using captcha to prevent automated access to
> stuff? (ie. require human interaction).

Yes.  But often it isn't implemented nicely.  It is a continuous
battle between the opposing forces.  And it isn't always clear which
is on the side of Good and which is on the side of Evil.  Sometimes it
is the Not So Good and the Somewhat Less Good.

> Sort of OT, but mentioned in this thread,
> Why use $(command) instead of `command`?
> Generally, I've always used $(command), but see scripts all over using
> `command`, and wondered if there were advantages of one over the other.
> It seems they give the same result, no?

The `...` is the original Bourne shell syntax for executing a command
and replacing the output from it onto the command line.  It is the
oldest method and in the simple case works everywhere.  However the
quoting rules are difficult.  Quoting includes both double and single
quotes and also includes nested `...` statements within `...`
statements.  There is always a quoting solution but it can be tedious
to create correctly.

The $(...) is newer syntax from ksh (newer from 1986 or so) which was
standardized into POSIX and therefore all POSIX shells will support
it.  The use of matching parenthesis means that nesting of commands is
simpler.  Most importantly the quoting rules are regular throughout.
You can even nest $(...)  inside of $(...).  For example: $(...  $(...) )

The simpler and regular quoting rules wins the choice for me.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: