Mailinglist Archive: opensuse (950 mails)

< Previous Next >
Re: [opensuse] Re: cli find cmd syntax
On 01/03/2015 08:35 AM, Hylton Conacher (ZR1HPC) wrote:
Aaron,

That aNTon not aARon.
You don't want to deal with aaron, trust me!



Thank you for the time and comments posted. All valid and I have replied
in-line.

On 30/12/14 15:19, Anton Aylward wrote:
On 12/30/2014 04:10 AM, Hylton Conacher (ZR1HPC) wrote:

.... [snip] ..

RTFM MAN(bash) on "QUOTING"

Thanks, man page read and understood to some extent. As I mentioned to
Luuk, whilst \ indicates that the command is not finished and continues
on the next line,

NO!
A \ at the end of the line indicates the command is not finished, as in

find $HOME/Maildir -type d | egrep -v \
.....

A \ inline means "take the next character literally"

So when you pasted the multiline command as a single line the

..... \
| ..

got converted to

...... \| ......

Stop and think. Interpret that in terms of what i just said above.

The backslashes are redundant but do not actually affect operation.

What's going on here is that you made a mistake that cancelled itself
out, but was a mistake none the less and simply added to the confusion.

That is the backslash is a line continuation character.
It means, in the above example, that all the stuff is on one line.
Those backquotes should not appear when you do make it into one line.

But are they needed given the above command executed fine despite being
more then one line long?



Seems <quote> $>man bash </quote> is going to be VERY WELL read :)

${EXPLETIVE} ${OBSCENITY} RIGHT!

Almost all your problems arise from a lack of understand of shell basics.



<snip>

A bit of RTFM and a bit of experimentation with each command separately
would have uncovered a lot.

I would agree, however in my own defence knowing what to look up in the
man pages is always a good starting point :)

$ man bash
$ man bashbuiltins

http://shop.oreilly.com/product/9780596009656.do
or if you don't like dead trees
http://ibi.cqupt.edu.cn/download/computer/linux/Learning.the.Bash.Shell.3rd.pdf

even googling for "learning bash shell" will help you.
GO GOOGLE!


But the real issue is diligent study not just a superficial scan and
asking for hand-holding over every detail.






My 2c:
Double quotes are better because it seems single quotes can be acted
upon inside them whereas they cannot if enclosed in single quotes.

NOT!

Context is Everything.

First, don't confuse single quotes with backtiks.

If you had RTFM you'd see that

'string' is not the same as `string`

You should also look to see what $(string) is

You should also look to see the differnce between

'$PATH' and "$PATH"

Oh, and '\$PATH' and "\$PATH"
and while about it
'\\$PATH' and "\\$PATH"

The issue isn't that one is right or one is better, it is a matter of
what is appropriate in the particular context.

You should also understand how quotes of various kinds are "stripped
off" as arguments are passed.

And yes it is all in the shell man page.



Lets not but rather concentrate on learning to code cli commands so that
they give us the correct answers we seek.

As Larry said about Perl, but its equally applicable to shell, (or Ruby,
or C or just about any language)

There's more than one one way to do things.

There are not 'correct answers', only answers that give us the results
we want.


--
/"\
\ / ASCII Ribbon Campaign
X Against HTML Mail
/ \
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups