Skip to main content

Questions tagged [quoting]

Strings are typically delimited by quotes, which raises the problem of dealing with strings that include quotes.

7 votes
3 answers
635 views

Is it possible to print a command so that the output can be parsed to create the same command?

The question may sound quite complicated, but in fact it is not! Consider: % f() { echo "$@"; } % f a a % f cmd -o"value with space" cmd -ovalue with space % f cmd -ovalue with ...
U. Windl's user avatar
  • 1,493
3 votes
1 answer
385 views

Problem with single quote in Bash [duplicate]

I have a sh script for initializing dzen2, and I want to use Source Code Pro font to use there. Here's the code... param="-p -dock -fn 'Source Code Pro-10'" # the generated_output function ...
manungsa's user avatar
1 vote
1 answer
68 views

Why does enclosing a command in double quotes affect aliases?

I have an alias rm='/bin/rm -i' and I know that if I type "rm" filename in the command line, the alias will be ignored somehow and the normal rm command without the -i flag will be called, ...
BrassPandaSax's user avatar
1 vote
1 answer
3k views

How do I quote square brackets in Ansible variable value for regexp parameter?

I use the ansible.builtin.lineinfile module to modify a PHP-FPM pool configuration file. How should I quote the square brackets (annot.: or other special characters) in a value of a variable for the ...
togo's user avatar
  • 13
4 votes
2 answers
647 views

How to print a double quote in POSIX scripting?

So far, I've been using "\"" to print a double quote: $ x="abc def" $ echo "x=\"$x\"" x="abc def" However, it seems like that behavior is ...
finefoot's user avatar
  • 3,132
3 votes
1 answer
402 views

Why is "${1-"$var"}" (option 6 down below) not mentioned in POSIX?

The only reference I could find in the spec is this: It would be desirable to include the statement "The characters from an enclosed "${" to the matching '}' shall not be affected by ...
QuartzCristal's user avatar
2 votes
1 answer
474 views

rsync does not exclude specified directory starting with a hash character (#)

I am trying to exclude the #recycle directory with rsync: $ rsync -Hauv -h -P --exclude '#recycle/' --exclude @eaDir/ --exclude '.DS_Store*' --exclude desktop.ini user1@src_server:/volume2/...
SebMa's user avatar
  • 2,199
6 votes
1 answer
3k views

Getting jq error when using variable in command line

I am using jq to get the tag_name index with the script: curl \ https://api.github.com/repos/checkstyle/checkstyle/releases \ -H "Authorization: token $GITHUB_TOKEN" \ -o /var/tmp/cs-...
Rahul Khinchi's user avatar
2 votes
1 answer
132 views

Any shell where expansions are turned off without escaping or quoting?

Say, with zsh one can prefix a command with noglob to "turn off filename generation (globbing)". I'm looking for a shell where similar approach can be used to disable not only globbing but ...
poige's user avatar
  • 6,270
7 votes
3 answers
3k views

How to use jq to return information to the shell, taking whitespace into account?

Given this file: $ cat fruits.json [ { "name": "apple" }, { "name": "banana\nfofanna" }, { "name": "my kiwi" } ] how can one use jq ...
jrw32982's user avatar
  • 875
0 votes
1 answer
41 views

How Can I Interpret Quoted Wildcards

I am writing a shell script and I need to interpret quoted wildcards. "R Programming*" I do not want the * asterisk to be taken literally. I want it to be interpreted as a wildcard. "R ...
Amarakon's user avatar
  • 333
8 votes
1 answer
5k views

What are curly quotes and can I use them in my code?

Somehow curly quotes got into my code and I'm getting unexpected behavior #!/bin/sh if [ foo = ‘foo’ ]; then echo yes else echo no fi I would expect this to echo yes but instead it echoes no.
jesse_b's user avatar
  • 37.5k
2 votes
1 answer
942 views

How to properly use quotes for a bash function?

I am trying to define the following bash function in my .bashrc file: function myfind() { find $1 -not -path venv -not -path .tox -name "$2" | xargs grep -n "$3" } which is ...
Alex's user avatar
  • 5,730
1 vote
2 answers
7k views

unexpected EOF while looking for matching `''

I have created a script to export CSV data to mysql table. #!/bin/bash cd /data/NEW for f in User* do mysql --user="root" --password="user@123" -e "LOAD DATA LOCAL ...
edublog's user avatar
  • 83
3 votes
1 answer
278 views

Recursively renaming apostrophs ' in filenames (Bash)

Need to remove apostrophes from files. I have tried several approaches, also from Stackexchange. I am on a Synology NAS, so I don't have Python, or Perl and furthermore I have to exclude certain ...
Gary U.U. Unixuser's user avatar

15 30 50 per page
1 2
3
4 5
72