Quoting and escaping is really an important way to influence the way, Bash treats your input. There are three recognized types:
* per-character escaping using a backslash: \$stuff
* weak quoting with double-quotes: "stuff"
* strong quoting with single-quotes: 'stuff'
Quoting and escaping is really an important way to influence the way, Bash treats your input. There are three recognized types:
* per-character escaping using a backslash: \$stuff
* weak quoting with double-quotes: "stuff"
* strong quoting with single-quotes: 'stuff'
ok, having the following problem:
using vim editor in fedora 12
this scripts function is to replace "replace/word --> word replaced" in the file "testing" using sed over ssh .
Okay. My understanding (partly from http://www.serverwatch.com/tutorials...es-in-Bash.htm) and other sources is that single quotes in bash (') mean that all special characters are ignored.
So I would expect that:
Code:
grep '140|150' test.txt
will match 140 or 150. Instead it errors. I turns out I have to escape the followinf characters to use them.
Code:
?
I recently had trouble with some regex on the command-line, and
found that for matching a backslash, different numbers of
characters can be used. This number depends on the quoting used for
the regex (none, single quotes, double quotes).
I have a directory "a b c/x y z"
I would like to assign it an environment variable so I can "cd" to it, as in:
A="a b c/x y z";export A
so that I can "cd $A".
I've tried single quotes, double quotes, backslashes and permutations thereof, but NOTHING works.:wall:
Any help would be graciously accepted.
I've found this script which seems very promising to solve my issue:
To search and replace many different database passwords in many different (.php, .pl, .cgi, etc.) files across my filesystem.
I've had the same issue today and found a somewhat safer workaround (I think). Uninstalling bash didn't seem right.Scimmia was right, pacman -Qo /usr/bin/bash said no package owned that file, and ls -l /usr/bin/bash showed it was only a symlink to /bin/bash, so I simply deleted it "rm /usr/bin/bash" and re-installed my stuff.
I want to used sed or some other linux command to convert special characters in XML files.
Here is an example:
-bash-3.2$ echo "P&G"
P&G
Now I want to change the "&" to "&" so I run:
-bash-3.2$ echo "P&G" | sed -e "s/&/&/ig"
P&G
I got the result I want, but if someone runs the conversion program again,