Questions tagged [quoting]
Strings are typically delimited by quotes, which raises the problem of dealing with strings that include quotes.
1,088 questions
3
votes
1
answer
161
views
Handling of Single Quotes inside a Here-Document
According to the Shell Command Language Specification: "2.7.4 Here-Document":
Any <backslash> characters in the input shall behave as the <backslash> inside double-quotes (see 2....
3
votes
1
answer
145
views
Wine cmd automatically escapes quotes, adds backslash
$ wine cmd /c 'echo "hello world"'
\"hello world\"
Where do the backslashes come from?
The command behaves differently in an interactive session:
$ wine cmd
Microsoft Windows 6.1....
0
votes
2
answers
96
views
How to replace all `[` and `]` in sed?
Logical way would be to use an 's/[\[\]]/_/g' regexp replace, however it does not work as intended to.
It replaces a chain of [ and ] with a single _.
$ echo 'x[]x'|sed -E -e 's/[\[\]]/_/g'
x_x
$ echo ...
2
votes
1
answer
98
views
A .desktop entry for a link in my dock always overwrites my edits, so it doesn't show up
PROBLEM
Hi, I'm trying to make a .desktop entry for jetbrains toolbox (a program), because for some reason, the desktop entry they included isn't showing the icon on my system (popOS 22.04, a Ubuntu ...
6
votes
2
answers
967
views
Ansible will not accept the quoting that it is telling me to add
I'm writing an ansible playbook, which I'm fairly to. I'm having issues with ansible-playbook complaining about my quotes, which from my understanding are correct. I've tried 3 things described at the ...
2
votes
1
answer
88
views
How to correctly handle apostrophes in Ansible templates for SQL statements?
I wrote an Ansible playbook to grab information from some YAML files and store it in a MariaDB database.
It uses this Jinja SQL template:
REPLACE INTO mytable(hostname,fqdn,owner, ...) VALUES
{% for ...
2
votes
2
answers
183
views
How does `*\ *` work in bash?
There is an answer from SuperUser, which renames filenames containing whitespace:
for f in *\ *; do mv "$f" "${f// /_}"; done
The part I don't understand is *\ *.
The author wrote ...
4
votes
1
answer
190
views
How to split output of a shell command on spaces while taking into account quoting?
I have a command that produces a list of arguments, quoting then if neccesary (https://docs.python.org/3/library/shlex.html#shlex.quote). I need them to pass them as command arguments in a zsh script (...
-1
votes
1
answer
97
views
tmux quoting problem within display-menu
This command works as expected if I run it in the tmux command line:
list-panes -a -F "pane ID: #{p3:pane_id} TTY: #{p11:pane_tty}"
Output:
pane ID: %1 TTY: /dev/pts/35
pane ID: %2 TTY:...
0
votes
1
answer
136
views
How does `find` replace `{}` if it contains special characters like `"`?
Recently when I read one QA, it has some unexpected behaviors for me:
~/findtest % echo three > file\ with\ \"double\ quotes\"
~ % find findtest -type f -exec sh -c 'set -x;cat "{}&...
0
votes
2
answers
745
views
Why does the "cp" command not work with pasted directory path from "pwd | pbcopy" command?
I ran pwd | pbcopy command in Terminal on my MacBook Pro to copy the working directory to the clipboard. The working directory looks like this:
/Users/JohnSmith/PycharmProjects/100 Days of Code - The ...
1
vote
1
answer
161
views
Quotation marks in filenames. Can they mess with quotation marks in shell code?
As far as I know, a safe and portable filename can consists of aA-zZ 0-9 hyphen and underscore only. At the same time, if we move away from the safe file-naming practices, we can use characters such ...
6
votes
3
answers
1k
views
bash script quoting frustration
This problem is driving me crazy. From the command prompt I can enter this command and it works as expected (records where the INFO/RegionType tag contains the value Core are emitted in the output ...
0
votes
1
answer
675
views
passing parameters to driver
I'm doing a Linux driver tutorial, and I have encountered a problem
with the sample lesson of passing parameters to the driver.
I tried another parameter-passing example I found on the internet
with ...
0
votes
3
answers
239
views
How to escape both single quotes and exclamation marks in bash
I have a long command and I just want to use alias to shorten it. But the command contains single quotes and exclamation marks.
The origin command is ldapsearch -x -H ... -w 'abc!123'.
I tried alias ...