Questions tagged [quotes]

Computer programming languages' facility for embedding text in source code, also known as String literals

In plain English: String literals can be enclosed in matching single quotes (') or double quotes (").

References:

2134 questions
1417
votes
40 answers

How can I output MySQL query results in CSV format?

Is there an easy way to run a MySQL query from the Linux command line and output the results in CSV format? Here's what I'm doing now: mysql -u uid -ppwd -D dbname << EOQ | sed -e 's/ /,/g' | tee list.csv select id, concat("\"",name,"\"") as…
MCS
  • 22,113
  • 20
  • 62
  • 76
873
votes
7 answers

Difference between single and double quotes in Bash

In Bash, what are the differences between single quotes ('') and double quotes ("")?
jrdioko
  • 32,230
  • 28
  • 81
  • 120
772
votes
13 answers

When to use single quotes, double quotes, and backticks in MySQL

I am trying to learn the best way to write queries. I also understand the importance of being consistent. Until now, I have randomly used single quotes, double quotes, and backticks without any real thought. Example: $query = 'INSERT INTO table (id,…
Nate
  • 26,164
  • 34
  • 130
  • 214
744
votes
8 answers

YAML: Do I need quotes for strings in YAML?

I am trying to write a YAML dictionary for internationalisation of a Rails project. I am a little confused though, as in some files I see strings in double-quotes and in some without. A few points to consider: example 1 - all strings use double…
Alexander Popov
  • 23,073
  • 19
  • 91
  • 130
715
votes
8 answers

Insert text with single quotes in PostgreSQL

I have a table test(id,name). I need to insert values like: user's log, 'my user', customer's. insert into test values (1,'user's log'); insert into test values (2,''my users''); insert into test values (3,'customer's'); I am getting an error…
MAHI
  • 9,263
  • 11
  • 36
  • 47
639
votes
8 answers

Expansion of variables inside single quotes in a command in Bash

I want to run a command from a bash script which has single quotes and some other commands inside the single quotes and a variable. e.g. repo forall -c '....$variable' In this format, $ is escaped and the variable is not expanded. I tried the…
Rachit
  • 6,531
  • 3
  • 16
  • 9
476
votes
21 answers

How to run an EXE file in PowerShell with parameters with spaces and quotes

How do you run the following command in PowerShell? C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql="Data Source=mysource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;" -dest:dbfullsql="Data…
Vans
  • 4,769
  • 2
  • 16
  • 3
404
votes
10 answers

How can I escape a double quote inside double quotes?

How can I escape double quotes inside a double string in Bash? For example, in my shell script #!/bin/bash dbload="load data local infile \"'gfpoint.csv'\" into table $dbtable FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY \"'\n'\"…
Sean Nguyen
  • 12,528
  • 22
  • 74
  • 113
348
votes
5 answers

How to execute a bash command stored as a string with quotes and asterisk

I try to execute the following command : mysql AMORE -u username -ppassword -h localhost -e "SELECT host FROM amoreconfig" I store it in a string : cmd="mysql AMORE -u username -ppassword -h localhost -e\"SELECT host FROM amoreconfig\"" Test…
Barth
  • 15,135
  • 20
  • 70
  • 105
315
votes
7 answers

What is the difference between single and double quotes in SQL?

What is the difference between single quotes and double quotes in SQL?
Vineet
  • 5,029
  • 10
  • 29
  • 34
304
votes
4 answers

When to wrap quotes around a shell variable?

Should or should I not wrap quotes around variables in a shell script? For example, is the following correct: xdg-open $URL [ $? -eq 2 ] or xdg-open "$URL" [ "$?" -eq "2" ] And if so, why?
Cristian
  • 6,765
  • 7
  • 43
  • 64
284
votes
5 answers

What do single quotes do in C++ when used on multiple characters?

I'm curious about this code: cout << 'test'; // Note the single quotes. gives me an output of 1952805748. My question: Is the output an address in memory or something?
lucidreality
  • 2,587
  • 2
  • 14
  • 4
270
votes
11 answers

How to select between brackets (or quotes or ...) in Vim?

I'm sure there used to be a plugin for this kinda stuff, but now that I need it, I can't seem to find it (naturally), so I'll just ask nice and simple. What is the easiest way to select between brackets, or quotes, or generally a list of matching…
Rook
  • 60,248
  • 49
  • 165
  • 242
256
votes
6 answers

Convert XmlDocument to String

Here is how I'm currently converting XMLDocument to String StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); xmlDoc.WriteTo(xmlTextWriter); return stringWriter.ToString(); The problem…
akif
  • 12,034
  • 24
  • 73
  • 85
252
votes
13 answers

Escape quotes in JavaScript

I'm outputting values from a database (it isn't really open to public entry, but it is open to entry by a user at the company -- meaning, I'm not worried about XSS). I'm trying to output a tag like this:
Matt Dawdy
  • 19,247
  • 18
  • 66
  • 91
1
2 3
99 100