Re: Bash commands: maybe they want to drive us crazy?
From: GP (gilpel_at_inverse.nretla.org)
Date: 07/01/04
- Next message: Christopher Browne: "Re: rsync and file renaming"
- Previous message: Crashdamage: "Re: Help a windows guy"
- In reply to: Bill Unruh: "Re: Bash commands: maybe they want to drive us crazy?"
- Next in thread: Keith Keller: "Re: Bash commands: maybe they want to drive us crazy?"
- Reply: Keith Keller: "Re: Bash commands: maybe they want to drive us crazy?"
- Reply: Chris F.A. Johnson: "Re: Bash commands: maybe they want to drive us crazy?"
- Reply: P.T. Breuer: "Re: Bash commands: maybe they want to drive us crazy?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jun 2004 23:48:28 -0400
Bill Unruh wrote:
> ]find -iname . "*IPv6*"
>
> -iname is an option which takes one argument. That argument to the option in this case is
> '*IPV6*' (NOT "*IPv6*" because the latter would cause the shell to expand
> the *s, not find)
Ok. Let's examine this first argument. Mr Unruh pretends that
double quotes cause the shell to expand the *
whereas
single quotes would cause the find command to expand the *
Which means that a shell command and the shell itself are two very different
things.
Well... if that's not new Linux to you, it certainly is to me and there is
absolutely no doubt I could have a rather lenghty discussion on the matter.
But, since "I" know nothing, in a socratian kind of way, I'll let my system answer.
EVERYTHING YOU ALWAYS WANTED TO KNOW ABOUT QUOTES
(but were too afraid to ask ;)
~$ echo `$LOGNAME`
-bash: gp: command not found
The shell seems to expect a command inside back quotes (or back ticks, as they
are often refered to). It's not pleased with a variable. Let's feed it a command!
~$ echo `ps`
PID TTY TIME CMD 1779 pts/2 00:00:00 bash 1856 pts/2 00:00:00 ps
The shell interprets the command.
~$ echo '$LOGNAME'
$LOGNAME
Here, the single quotes turns the shell into parrot. Let's feed it a command.
~$ echo 'ps'
ps
Same here. Sorry for this abominable untechnical language, but the single
quotes do turn the shell into a parrot.
~$ echo "$LOGNAME"
gp
Double quotes expand the variable into its value.
~$ echo "ps"
ps
But dumbly echo the command exactly as single quotes do.
As we all know:
If we include something inside of double-quotes, everything loses its special
meaning except for the variable operator ($), the back-slash (\), the back-tick (`)
http://www.linux-tutorial.info/modules.php?name=Tutorial&pageid=20
Thanks Linux tutorial!
So, please cd to /etc and issue the following commands:
find . -iname '*net*'
find . -iname "*net*"
What's the difference? None! Why? Because, since there is no $ , \ or `` inside
the double quotes, it is exactly equivalent to single quotes.
Conclusion:
Contrary to the pretention of Mr Unruh, there is absolutely no difference
between a shell and a shell command interpretation.
This being a very basic matter, either Mr Unruh is a dummy posing as an expert
or he's a troll. Lady and gents, the choice is yours.
What? Yes, of course, Mr Unruh, you may engrave my name 'till' the end of times
in your kill file. My pleasure! So can you, Mr Davidson. I don't need your
/advice/ and I do believe nobody here does.
Best regards!
GP
- Next message: Christopher Browne: "Re: rsync and file renaming"
- Previous message: Crashdamage: "Re: Help a windows guy"
- In reply to: Bill Unruh: "Re: Bash commands: maybe they want to drive us crazy?"
- Next in thread: Keith Keller: "Re: Bash commands: maybe they want to drive us crazy?"
- Reply: Keith Keller: "Re: Bash commands: maybe they want to drive us crazy?"
- Reply: Chris F.A. Johnson: "Re: Bash commands: maybe they want to drive us crazy?"
- Reply: P.T. Breuer: "Re: Bash commands: maybe they want to drive us crazy?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|