[Top][All Lists]

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

Re: Syntax Question...

From: Dennis Williamson
Subject: Re: Syntax Question...
Date: Tue, 16 Aug 2011 17:46:38 -0500

On Tue, Aug 16, 2011 at 4:11 PM, Linda Walsh <address@hidden> wrote:
> Dennis Williamson wrote:
> ----
>   Who's Greg?  I mean before some days ago and other than seeing the name on
> this list, who is he from Adam that someone should think his FAQ is
> important?
> I don't know the name other than from seeing it this list (not sure if
> others or not).
>   That said, I hope you understand that you put the "donot messages" into
> the
> same importance level as the "how to" stuff -- which I ask -- why is it that
> it
> is important (I don't know -- previous maintain of bash?  Head of some Gnu
> org? He's not Stallman, and other than him, I don't know if I've personally
> me any
> of the other gnu people...

Does it matter? He's someone who's put a lot of work into an extremely
useful resource. Also, "The 'official' channel FAQ for freenode's
#bash irc channel is BashFAQ (http://mywiki.wooledge.org/BashFAQ)."

>   Even apart from my ignorance, there are some known problems with his
> knowledge
> base.   1) an extremely noticeable bias against "-e", to the point that
> attempts by other
> people to see it "fixed"" and made useful are met with, at least,
> resistance, if not
> some irritation.

Don't use -e (in any version of Bash or other Bourne-related shells) -
it's a vestigial wart. Don't dream of a day when it's fixed - it's a
vestigial wart. Do proper error handling - including, by the way,
using trap.

> 2) His knowledge base about bash seems to be dated or lacking.
> His page on indirect assignment skips using arith expressions and skipped
> one line assignments for assigning to indirect vars using the "<<<" syntax
> (which
> can be derived from his "<<" examples, but he totally doesn't talk about
>>  b=0
>>  a=b
>>  (($a=32)
>>  echo $b
> 32

You *can* do indirection. It *can* be useful. If you can accomplish
what you need to do without it, it's better. There are gotchas.

a='c=3,d'    # perhaps this value was injected maliciously in some user input
(( $a = 32 ))
echo "b=$b, c=$c, d=$d"
b=0, c=3, d=32

Another example:

a='b*'    # oops, typo
(($a=32))    # no space before the equal sign
echo $b

Also fun:

$ r=s; s=t; t=u; u=v; v=w; w=1234; (( a = r )); echo $a

> Only mentioning these items as have already mentioned them directly ...
> there
> are other problems with his knowledge base that make me only likely to
> accept his
> information in the context it was given -- but not for every purpose.   Of
> course if he
> believe to speak for every purpose, then more power to him, but let's not
> speak,
> sideways, thusly!  instead ...the below:

>>>>> [3]snap_prefix="$mp/$prefix$snap_today*"

My apologies - I overlooked the asterisk.

> So it doesn't invoke any aliases for 'ls'...  -- my bashrc has "ls -CF", so
> it puts
> ID chars on the end...
> so when I ran that code, I got back "xxyz/"  which I wasn't expecting,
> so 'ls' makes sure it does a path search for it....

Aliases shouldn't be used inside scripts.

Visit serverfault.com to get your system administration questions answered.

reply via email to

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