[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Re: Newbie - shell program problem

I don't want to be nitpicking, but here goes...

Anyway, the original query has been answered, so it is time for us flame
mongers to take over...

Raja Subramanian forced the electrons to say:
> On Sun, 29 Oct 2000, YL Narayana wrote:
> > MATCHES = `ls -d $1 2>/dev/null | wc -l`
> In your case, you set the environment variable MATCHES to an empty string and
> tried to run the output of `ls -d ...<snip>...` as a program. Not what you
> expected.

Not exactly - he tries to run the program MATCHES, which might or might
not be in his path, with $1 as '=' and $2 as the number of files in the
directory passed as an argument to his shell function.

> It seems that shell programmers know little about coding style...
> What you are probably thinking now is correct, "the shell is stupid!". True,
> the shell merely does string manipulation and is quirky and you will have to
> live with it. Unfortunately so.

We can have a long flame war about this, but LIH is better off without it.
I would suggest bash2(1) for background reading.


The prompt for all occasions:
export PS1="F:\$(pwd | tr '/[a-z]' '\134\134[A-Z]')> "
--------------- Binand Raj S. (binand@xxxxxxxxxxxxxxxxxxxxx)