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....
13
votes
1
answer
2k
views
Why doesn't GNU parallel work with "bash -c"?
% echo -e '1\n2' | parallel "bash -c 'echo :\$1' '' {}"
:1
:2
% echo -e '1\n2' | parallel bash -c 'echo :\$1' '' {}
%
I'd expect the second line to act the same.
2
votes
2
answers
264
views
awking for command options from man page
I am trying to auto-generate tab-completions for different commands. I am piping man pages for different commands into awk, then searching for command line options (eg. -shortopt --long-option) ...
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 ...
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....
4
votes
3
answers
15k
views
Escape [ in grep
I read strings from stdin and I want to display the users that match the strings. Problem is, if the user inputs the character '[', or a string containing it.
grep -F does not work because the line ...
1
vote
1
answer
149
views
In the nullmailer `remotes` configuration file, how do I quote single quotes in the password?
I'd like to use nullmailer to have my Debian (bullseye and bookworm) systems send system-generated email messages to the appropriate recipient. nullmailer is configured (among others) by the file /etc/...
106
votes
4
answers
65k
views
How can I use column to delimit on tabs and not spaces?
I'd like to use the Unix column command to format some text. I have fields delimited by tabs, but within each field there are also spaces. column delimits on white space (tabs and spaces). How can I ...
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 ...
67
votes
5
answers
50k
views
How to quote arguments with xargs
Suppose that I want to delete all files in a folder that are greater than 1 MB.
$ find . -size +1M | xargs -0 rm
This will not delete files that have space in their names. So I want it to quote all ...
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 ...
1
vote
1
answer
629
views
bash cd issue with path containing spaces: "too many arguments" [closed]
I created a path with spaces, and when I try to change directory I get "too many arguments" error message despite escaping the spaces or quoting the path :
Here are the tests I made :
# ...
0
votes
2
answers
2k
views
Exclude the output from ssh and only log the error if found
typeset -f | sshpass -e ssh -o StrictHostKeyChecking=no user@${IPADDRESS} "
$(cat);
IFERROR=$(checkscript);
echo "$IFERROR"" > ${SSHTEMPFILE} 2>&1
This line...I can't exclude the "...
5
votes
3
answers
4k
views
How do I join an array of strings where each string has spaces?
My bash script:
#!bin/bash
MY_ARRAY=("Some string" "Another string")
function join { local IFS="$1"; shift; echo -e "$*"; }
join "," ${MY_ARRAY[@]}
I want the output to be:
Some string,Another string....