View previous topic :: View next topic |
Author |
Message |
mansniks Apprentice
Joined: 19 Nov 2007 Posts: 290
|
Posted: Sat Oct 04, 2008 9:31 am Post subject: BASH mystery 2: |
|
|
echo "echo \"!\""
bash: !\: event not found |
|
Back to top |
|
|
Evildad Guru
Joined: 15 Apr 2004 Posts: 475
|
Posted: Sat Oct 04, 2008 9:39 am Post subject: |
|
|
echo 'echo \"!\" '
€dit: What is your expected output?
should be done with |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Sat Oct 04, 2008 12:45 pm Post subject: |
|
|
When you type a word preceeded by an "!", bash thinks you want to recall a previous command or "event". The message indicates no matching event was found in your recent command history. You can suppress the special meaning of ! by quoting it, for example: \!
echo "echo \"\!\"" _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
mansniks Apprentice
Joined: 19 Nov 2007 Posts: 290
|
Posted: Sat Oct 04, 2008 1:13 pm Post subject: |
|
|
echo "echo \"\!\""
echo "\!"
(so can't without '..)
Any html, where it is best to read about ' and " differences in bash? (somehow those long manuals are hard to browse and find something in them..) |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
|
Back to top |
|
|
notHerbert Advocate
Joined: 11 Mar 2008 Posts: 2228 Location: 45N 73W
|
Posted: Sat Oct 04, 2008 2:18 pm Post subject: |
|
|
Code: | ~ mybox $ echo echo !
echo !
| |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Sat Oct 04, 2008 2:21 pm Post subject: |
|
|
see this is the problem
HE never stated what he /really/ wants, what his desired output is...
Quote: |
bashphorism 1: the questioner's first description of the problem/question will be misleading.
bashphorism 2: The questioner will keep changing the original question until it drives the helpers in the channel insane.
"Offtopicness will continue until someone asks a bash question that falls under bashphorisms 1 and/or 2, and greycat gets pissed off."
Bashphorism 4:The questioner will not read and apply the answers he is given but will instead continue to practice b1 and b2
"The ignorant will continually mis-educate the other noobies"
When given a choice of two solutions, the newbie will always choose the more complicated, or less portable, solution.
http://wooledge.org/mywiki/XyProblem
|
_________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
Evildad Guru
Joined: 15 Apr 2004 Posts: 475
|
Posted: Sat Oct 04, 2008 2:25 pm Post subject: |
|
|
sh-3.2$ echo echo !
echo !
Hopefully he'll let us know what he really wants to do |
|
Back to top |
|
|
notHerbert Advocate
Joined: 11 Mar 2008 Posts: 2228 Location: 45N 73W
|
Posted: Sat Oct 04, 2008 2:45 pm Post subject: |
|
|
mansniks wrote: | Any html, where it is best to read about ' and " differences in bash? (somehow those long manuals are hard to browse and find something in them..) |
Code: | ~ mybox $ FOO=123
~ mybox $ echo "$FOO"
123
~ mybox $ echo '$FOO'
$FOO |
|
|
Back to top |
|
|
|