Questions tagged [escape-characters]

107 questions
240
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
  • 14,496
  • 18
  • 73
  • 119
105
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,323
  • 3
  • 11
  • 12
84
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.…
65
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,845
  • 2
  • 12
  • 11
28
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
  • 418
  • 1
  • 4
  • 9
24
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
  • 802
  • 2
  • 7
  • 18
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,285
  • 2
  • 19
  • 29
20
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
  • 603
  • 2
  • 5
  • 10
17
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,372
  • 20
  • 62
  • 82
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
  • 7,778
  • 34
  • 103
  • 145
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
  • 321
  • 2
  • 6
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
  • 3
  • 6
  • 14
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…
8
votes
1 answer

Enabling Italics, Underline on Emacs, Xterm and Putty

I'm using a Ubuntu (11.04 Server Edition) virtual machine as my development environment. It doesn't have a desktop environment since I don't think its necessary and I want to keep it lightweight. I'm accessing it via SSH with PuTTY on Windows 7. I…
adeandrade
  • 181
  • 1
  • 2
8
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,510
  • 1
  • 15
  • 27
1
2 3 4 5 6 7 8