Questions tagged [quoting]

The use of quotation marks (typically, `'` or `"`) to mark tokens as string literals or strings subject to interpolation, or to treat multiple whitespace-separated tokens as a single unit.

Use this tag for questions about the correct use of quotation marks in programming, with respect to:

  • how to use quotation marks to mark text as a literal not to be interpreted in any way.
  • how to use quotation marks to mark text as subject to string interpolation.
  • how to escape (encode) quotation marks inside text already enclosed in quotation marks.

Especially in shell programming, with respect to:

  • when what quotation marks are needed, and if quoting is needed at all, including quoting of individual characters with \.
  • how to use quoting to partition a list of tokens into distinct arguments that may have embedded whitespace.
  • when quotation marks are considered part of the input vs. recognized syntactically by the shell (quote removal).
589 questions
17
votes
7 answers

How to put double quotes in VS2010 post build step

I'm trying to create a post build file copy step in VS2010 which handles path macros when they have embedded spaces. I've tried surrounding the copy commands in double quotes but I get error from when copy is invoked if $(SolutionDir) contains a…
JonN
  • 2,498
  • 5
  • 33
  • 49
16
votes
3 answers

'kubectl patch' works on Linux Bash but not in Windows Powershell ISE

The following command works fine on Ubuntu bash: kubectl patch deployment wapi-backend-d1 --patch '{"spec": {"template": {"metadata": {"labels": {"date": "test"}}}}}' The same command does not work in Windows Powershell Console (ISE). The error…
Asu
  • 1,723
  • 2
  • 21
  • 32
16
votes
2 answers

Tool to automatically rewrite a bash script with proper quoting?

I'm contemplating to make all bash scripts of a large codebase shellcheck compliant, but the task is overwhelming, because too many developers have historically ignored rule number one of all shell scripting: always use quotes. It would be helpful…
user2394284
  • 5,520
  • 4
  • 32
  • 38
16
votes
2 answers

csv writer in Python with custom quoting

I'm looking for a way to define custom quoting with csv.writer in Python. There are 4 built-in ways to qoute values: csv.QUOTE_ALL, csv.QUOTE_MINIMAL, csv.QUOTE_NONNUMERIC, csv.QUOTE_NONE However I need a quoting mechanism which will emulate…
freakish
  • 54,167
  • 9
  • 132
  • 169
16
votes
5 answers

Bash doesn't parse quotes when converting a string to arguments

This is my problem. In bash 3: $ test='One "This is two" Three' $ set -- $test $ echo $2 "This How to get bash to understand the quotes and return $2 as This is two and not "This? Unfortunately I cannot alter the construction of the variable called…
David
  • 265
  • 4
  • 8
14
votes
1 answer

perl6 signatures in POD

since --> is the preferred way to state the return type in a signature in perl6 I am wondering if or how it is possible to put the code of a function signature into C<...>. e.g. C Bool)>
Martin Barth
  • 796
  • 4
  • 13
14
votes
3 answers

Strange Lisp Quoting scenario - Graham's On Lisp, page 37

I'm working my way through Graham's book "On Lisp" and can't understand the following example at page 37: If we define exclaim so that its return value incorporates a quoted list, (defun exclaim (expression) (append expression ’(oh my))) > …
Nick Alger
  • 984
  • 7
  • 26
14
votes
5 answers

Is > ever necessary?

I now develop websites and XML interfaces since 7 years, and never, ever came in a situation, where it was really necessary to use the > for a >. All disambiguition could so far be handled by quoting <, &, " and ' alone. Has anyone ever been in a…
Boldewyn
  • 81,211
  • 44
  • 156
  • 212
12
votes
1 answer

Rows are lost when reading this tab-separated file with pandas read_csv

I have a .text file with following format, where fields (index number, name and message) are separated by \t (tab-separated): 712 ben Battle of the Books 713 james i used to be in TOM 714 tomy i was in BOB once 715 ben Tournaments of…
user4462740
12
votes
2 answers

Using a Variable (PowerShell) inside of a command

$computer = gc env:computername # Argument /RU '$computer'\admin isn't working. SchTasks /create /SC Daily /tn "Image Verification" /ST 18:00:00 /TR C:\bdr\ImageVerification\ImageVerification.exe /RU '$computer'\admin /RP password Basically I need…
RogerLawrence
  • 135
  • 1
  • 2
  • 9
11
votes
1 answer

How do I include ampersands in a powershell command in a batch file?

I am trying to download a Google sheet via a batch file. This works: powershell -Command "Invoke-WebRequest https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/export?exportFormat=tsv -OutFile output.tsv" When I specify which sheet/tab I want by…
Sarah Northway
  • 1,029
  • 1
  • 14
  • 24
11
votes
1 answer

Disambiguate the various quoting mechanisms in Julia metaprogramming

Could someone lay out clearly the various quoting mechanisms available for metaprogramming in Julia, and illustrate each one with a minimal example? So that it is clear which to use in which situation... As far as I can see there is: :(someExpr;…
P i
  • 29,020
  • 36
  • 159
  • 267
11
votes
2 answers

How do I escape single quote in command line query of psql?

I googled a lot but.. How do I escape single quote in command line query of psql ? psql -t -A -F $'\t' postgresql://zzzz:5432/casedb -U qqqq -c 'select id,ext_ids ->> 'qwe' as qwe from data ORDER BY qwe' > /jdata/qwe.tab Results in error ERROR: …
expert
  • 29,290
  • 30
  • 110
  • 214
11
votes
2 answers

Backslashes in Powershell

Why does the string for the -split parameter require two backslashes while the string for the -join parameter requires only one backslash? The backtick is the escape character in Powershell. What does a backslash preceding a character do for…
lit
  • 14,456
  • 10
  • 65
  • 119
10
votes
1 answer

PowerShell 7.3.0 breaking command invocation

I use WinSCP within a Powershell script. It suddenly stopped working. After a while I could figure out that the problem appeared from a more recent version of PowerShell: Reduced code: & winscp ` /log ` /command ` 'echo…
JFFIGK
  • 632
  • 1
  • 7
  • 24
1 2
3
39 40