Questions related to the use of single-quotes in different programming languages.
Questions tagged [single-quotes]
352 questions
4
votes
3 answers
wrapping commands through ssh: how to manage complex quotes?
I use an HPC cluster. The compute nodes can't have access to internet, only the frontal.
So I want to wrap all the commands that need to access internet in order to execute them on the frontal.
ex: for wget
#!/bin/bash
ssh frontal /bin/wget "$@"
->…

DuGNu
- 81
- 9
4
votes
1 answer
PHP: Convert single-quoted string into double-quoted
I need to convert string with unicode \xCODEs into regular string.
The issue is that string which I have as input seems to be single-quoted.
Is there any way to convert single-quoted string into double?
Here's some code for better…

Denis O.
- 1,841
- 19
- 37
4
votes
2 answers
Bash script with a command with lots of single and double quotes
I need to use the curl command:
curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://localhost:3030/widgets/welcome
in a bash script but instead of "Hey, Look what I can do!" after the "YOUR_AUTH_TOKEN"; I need a…

Cem Türkeş
- 43
- 2
4
votes
1 answer
Ansible escaping double quotes and single quotes
I would like insert a nrpe command in the nrpe.cfg with this ansible command
check_tomcat_threads.pl -H localhost -p 30011 -C '"http-bio-30011"' -w 200 -c 50
But the the problem are the '" and "'
To set this line in the nrpe.cfg use the command
…

Georg Gutsche
- 452
- 4
- 9
- 17
3
votes
4 answers
Making a new line with single quotes?
Can I do a line break like this '\n'?
Or do I must use double quotes - "\n"?

Run
- 54,938
- 169
- 450
- 748
3
votes
2 answers
Powershell variable expansion in single quoted string
I need to build a JSON variable that contains another JSON formatted content which should be formatted as a string. I'm putting the inner JSON into single quote so it wont get parsed along with the outer JSON. The inner JSON contains a variable that…

Royce
- 555
- 1
- 8
- 14
3
votes
3 answers
Negate Single Quote In Character Class
I have the following code where I am trying to replace assign with always @(*) using SED.
Essentially I am trying to ignore the ' in character class but SED still seems to match it. I don't want sed to catch the line if the line contains a ' (My…

Dheeraj Turaga
- 33
- 2
3
votes
5 answers
Unable to replace string in Swift
Trying to escape few special characters of string for sending it via xml api.
Tried below code but not working for all the occurrences of Single Quote (') and Double Quote (")
var strToReturn = "“Hello” ‘world’"
strToReturn =…

Dhaval H. Nena
- 3,992
- 1
- 37
- 50
3
votes
1 answer
C - single quotes vs double quotes
I'm curious about this code:
int a = 'ftyp'; // a == 1718909296
int b = *((int*)"ftyp"); // b == 1887007846
My question: Why a != b ?

codeDom
- 1,623
- 18
- 54
3
votes
2 answers
ColdFusion single quote issue with SQL Query
In my ColdFusion 11 app, with SQL Server 2008-R2, I've following cfquery tag inside a CF Component:
select name, state from myTable #REReplace(where_clause,"''","'","ALL")# …

nam
- 21,967
- 37
- 158
- 332
3
votes
2 answers
Printing in both double and single quotes
I am on exercise 8 of Learning Python the Hard Way, and I don't understand why certain lines in a print function are printed in single or double quotes.
The program reads as follows:
formatter = "%r %r %r %r"
print formatter % (
"I had this…

InvalidObjects
- 27
- 1
- 5
2
votes
1 answer
Difference between single quote and double quote string *types* in octave? Reason of warning?
I am aware that in octave escape sequences are treated differently in single/double quotes. Nevertheless, there seems to be a type difference:
Whereas class("bla") and class('bla') are both char,
typeinfo("bla") is string, whereas typeinfo('bla') is…

user2609605
- 419
- 2
- 14
2
votes
1 answer
How to select a column to appear with two single quote in the field
Here is my postgresql query
select 'insert into employee(ID_NUMBER,NAME,OFFICE) values ('''||ID_NUMBER||''','''||NAME||''','''||replace(DESIGNATION,'&','and')||''','''||replace(DEPT_NAME,'&','and')||''')' as col
from icare_employee_view
where…
2
votes
1 answer
PowerShell: escaping rules for CLI calls
As I have learned, when invoking PowerShell from cmd.exe, with the -Command option, escaping rules are essentially those used in Linux. So you use a backslash (\), rather than the usual backtick (`).
This is to say that you don't write:
C:\>…

antonio
- 10,629
- 13
- 68
- 136