Questions tagged [escaping]
25 questions
24
votes
3 answers
How does one escape the " ` " (accent grave/backtick) in a path?
I tend to prefix oft-used files and folders with the "accent grave" character (non-shift tilde, the back-tick, or plain-old accent, whathaveyou..), as it is easy to get at, and let's me sort things alphabetically, while letting me choose to show a…

mralexgray
- 1,353
- 3
- 12
- 29
13
votes
1 answer
Apache mod_rewrite double encodes query string on redirect
We've encountered a strange issue (a bug, perhaps?) with Apache mod_rewrite's behavior when passing through query strings.
To reproduce, we've set up a clean Ubuntu (oneiric) install with the default Apache configuration. We have enabled…

Erik Hesselink
- 231
- 2
- 7
9
votes
4 answers
Searching for literal "> \" using ack-grep
I am looking for lines that literally have a greater than character (a ">") followed by a space followed by a backslash character (a "\")
i.e., a line with this: > \
I thought escaping would allow this, and for the greater-than it does:
$…

Stephen Gornick
- 261
- 2
- 5
8
votes
3 answers
How to escape spaces in systemd unit files?
My unit file looks like this (already attempted to escape spaces as \x20 like the docs say):
[Unit]
Description=My…

Cobra_Fast
- 650
- 2
- 8
- 23
5
votes
1 answer
In a nginx configuration file, how to define a fastcgi_param that contains the "$" sign?
I'm trying to define a few environment variables for a PHP application but one of these variables contains the "$" sign. When I test the configuration file with nginx -t, I get an error message telling me that a variable does not exist. It seems to…

kant312
- 211
- 2
- 7
5
votes
2 answers
How to escape or remove double quotes in rsyslog template
I want rsyslog to write log messages in JSON format, which requires to use double-quotes (") around strings.
Problem is that values sometime include double-quotes themselves, and those need to be escaped - but I can't figure out how to do…

Evgeny
- 599
- 5
- 10
4
votes
3 answers
run local MySQL instance for fast mysql_real_escape_string calls
Currently all MySQL data/API calls are handled by a remote DB cluster (i.e. network latency is a factor in total script execution time).
To reduce execution time in this context, would it be sensible to run a local MySQL instance on each app server…

Andy
- 5,230
- 1
- 24
- 34
4
votes
0 answers
DSGET escapes hash signs (#) in outputted Distinguished Names (DN)s but expects unescaped hash signs for input
Lets say I want to do the very simple query in AD
dsquery user -name "John Smith" | dsget user -memberof -expand
This will output the DNs of the AD groups that this user belongs to. I can make it print the friendly group name via:
dsquery user…

Justin Dearing
- 1,037
- 12
- 33
3
votes
4 answers
How to escape "/" in a sed command in Puppet script?
In a config file, I'm trying to replace PREFIX=/jenkins with, say, PREFIX=/foobar.
On the (bash) command line, this works fine:
sed -i.bak s/PREFIX=\\/jenkins/PREFIX=\\/foobar/g /etc/default/jenkins
However, in a Puppet script (.pp file):
exec {…

Jonik
- 2,961
- 4
- 38
- 48
3
votes
1 answer
Executing bash code interactively using -c flag
I am trying to run a shell fragment with the bash interpreter. Using the -c flag allows me to provide the commands directly into command line without writing to a file. This is required for my usage.
Example working:
$ bash -c 'free -m'
The problem…

Justin
- 5,328
- 19
- 64
- 84
2
votes
1 answer
Passing inner quotes from EnvironmentFile variable to ExecStart
In the EnvironmentFile I have:
EBUSD_OPTS="--scanconfig -d /dev/ttyEBUS -c /etc/ebusd --log=\"all notice\" --log=\"update error\""
In the .service file:
EnvironmentFile=-/etc/default/ebusd
ExecStart=/usr/bin/ebusd $EBUSD_OPTS
I would expect the…

jjakob
- 51
- 1
- 5
2
votes
1 answer
bash: Something like quotemeta() for pattern characters?
Background
I am aware of bash's various string manipulation capabilities.
Also, I know I can escape special pattern characters with a backslash \.
For instance:
# x is a literal string 'foo*bar'
x="foo*bar"
# prints "*bar".
echo "${x##foo}"
#…

jwd
- 201
- 1
- 8
2
votes
2 answers
Properly escaping a path with spaces in CMD shell
I have the following path:
"d:\workspace\Server trunk - CI\make\make & publish.bat"
However, when I try to execute this from a cmd shell, I get the error:
'd:\workspace\Server' is not recognized as an internal or external command, operable…

Igal Tabachnik
- 405
- 1
- 5
- 11
2
votes
1 answer
Escape sequence for the escape key
On an SSH terminal, there is a command that takes over the terminal window, and it says I can press escape to end it.
My SSH terminal does not handle the escape key. What is the escape sequence (Ctrl+something) that I can use in its place. (or is…

700 Software
- 2,233
- 10
- 49
- 77
2
votes
2 answers
Printing a '$' (dollar sign) to a file
I want to echo/printf a dollar sign into a file - but echo $ > myfile or such does not work (not surprising).
I tried escaping it like echo \$ > myfile but it is also not working.
What is the correct way to perform it?
I'm working with TCSH on…

RonK
- 241
- 1
- 5
- 13