Questions tagged [quoting]
Strings are typically delimited by quotes, which raises the problem of dealing with strings that include quotes.
1,087 questions
3 votes
1 answer
117 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
86 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
79 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
852 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
83 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
179 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
156 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
85 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
120 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
657 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
139 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
587 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
220 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 ...
3 votes
1 answer
663 views
tcsh: Handle spaces in arguments when passing on to another command
I wrote a script that needs to call a command and pass on arguments. My script has its own parameters but some need to be passed through. This fails when arguments to my script have spaces in them. ...