Questions tagged [escape-characters]
108 questions
244
votes
6 answers
In bash, how do I escape an exclamation mark?
I want to do something like bzr commit -m "It works!". I can sort of escape the exclamation mark by doing bzr commit -m "It works\!". However, then my commit message includes the backslash. How do I escape the exclamation mark, while still ignoring…
Matthew
- 15,036
109
votes
8 answers
How do I escape spaces in command line in Windows without using quotation marks?
For example what is the alternative to this command without quotation marks:
CD "c:\Documents and Settings"
The full reason I don't want to use quotation marks is that this command DOES work:
SVN add mypathname\*.*
but this command DOES NOT…
David
- 1,403
85
votes
3 answers
Excel Conditional Formatting Escaping a Question Mark
I would like to use a conditional formatting rule in an excel file that would color any box with a question mark in it red. It seems that Excel is using a question mark as a wild card and will turn all cells with at least one character in them red.…
kzh
- 4,473
67
votes
5 answers
Escaping a password using mysqldump console
I am running a mysqldump via a bash script and have encountered a problem with a password that contains special characters.
mysqldump -hlocalhost -uUSERNAME -pPA$$W0RD DATABASE |
gzip >…
psx
- 1,895
30
votes
4 answers
How do you escape apostrophe in single quoted string in bash?
I don't understand how bash evaluates escaping of apostrophe characters in single quoted strings.
Here is an example:
$ echo ''\''Hello World'\'''
'Hello World' # works
$ echo '\'Hello World\''
> # expects you to continue input
I've tried looking…
Kibet
- 438
25
votes
2 answers
How to escape "!" and "&" in docker's environment varibles
I have a docker container I want to run and hand it over some passwords. One with an exclamation mark ! and the other one with an ampersand &. So I want to run this:
docker run -i -t --rm \
-e…
DASKAjA
- 842
22
votes
1 answer
Why does `echo -e "\\\SOME_TEXT"` show only one backslash?
Could some one explain what is happening behind the scenes in character escaping in Linux shell? I tried the following and googled a lot, without any success in understanding what (and how) is going on:
root@sv01:~# echo -e "\ Hello!"
\…
Mohammed Noureldin
- 1,355
21
votes
1 answer
How to escape "-" in bash
Possible Duplicate:
Unix tools: what if a file is named minus something?
Please tell me how to escape this:
[root@unix ~]# ./-sh
-bash: ./-sh: Permission denied
[root@unix ~]# chmod +x -sh
chmod: invalid mode: `-sh'
Try `chmod --help' for more…
soundhax
- 663
19
votes
1 answer
How can I tell Vim to show ANSI escape codes properly?
I'm trying to view and edit a file in Vim, but this file has ANSI escape codes:
^[[1m[0.05s elapsed, 00:00:13 total]^[[0m
How can I tell Vim to interpret them properly instead of just showing the raw code?
Nathan Fellman
- 9,662
13
votes
1 answer
How to use awk separator of single quote?
I'd like to use awk to pull out information from SQL output like the following:
(count(distinct serverclass)='2')
And need to extract the number, which is 2 in this example.
I'd like to do something like the following, but cannot figure out how to…
WilliamKF
- 8,058
11
votes
1 answer
How to escape "$@" in a makefile?
test:
@echo "#!/bin/bash\njava -classpath \"$(CLASSPATH)\" com.atm.ATM \"$@\"" > test
@chmod a+x test
I am trying to escape the "$@" so that it literally appears in the "test" script as "$@" (passing the arguments invoked on the bash script…
xomm
- 331
11
votes
6 answers
Is there a way to escape single-quotes in the shell?
E. g. I want to say
perl -e 'print '"'"'Hello, world!'"'"', "\n";'
Is there a less awkward way to do it, e. g. escaping single-quotes?
Yes, I know that I can write
perl -e 'print q[Hello, world!], "\n"'
perl -e 'print "Hello, world!\n"'
But this…
codeholic
- 455
9
votes
1 answer
How can I format this path to work as registry key value?
C:\Program Files (x86)\DotR\DotR.exe
I know I need to escape the backslashes like C:\\Program Files (x86)\\DotR\\DotR.exe but it still doesn't work. Do I need to handle spaces and parens as special characters and if so, how?
Edit with details: I'm…
pdizz
- 193
- 1
- 1
- 5
9
votes
1 answer
How to properly vim-escape a variable/register
For example, I want to highlight occurrences of the current yank register, i.e.,
:let @/=@"
It works, unless @" has 'funny' stuff in it like backslash.
I can do
:let @/=escape(@", '\\')
but I'm not sure if this is the right thing to do, and if it…
Vitaly Kushner
- 1,550
9
votes
2 answers
Escaping "=" (equal sign) in for /f
I'm trying to run the following command in a *FOR /F in Windows' shell …
wmic process where ParentProcessId=%%PID%% get ProcessId
The = between ParentProcessId and %PID% keeps getting replaced by a space.
The result being:
for /F "usebackq" %b in…
user545778
- 91