quotes

What does single quote do in windows batch files?

狂风中的少年 提交于 2019-11-26 15:26:55
I recently ran a command in windows cmd with single quotes in it and found that it did not behave as I expected. From trying to google "windows batch single quote vs double quote" I've found a few articles where people asked about having windows treat single quotes like double quotes, and about how bash treats single quotes and double quotes differently. However, I couldn't easily find an explicit explanation of what single quotes do in windows batch commands. So what do single quotes do in windows batch files? Do they perform any sort of quoting functionality at all? Single quotes are not

How to substitute quoted, multi-word strings as arguments?

北战南征 提交于 2019-11-26 14:36:04
问题 I'm trying to substitute a string variable, containing multiple quoted words, as a parameter to a command. Thus, given the following example script (Note the -x in the shebang, which causes the output to be logged to stderr), #!/bin/bash -x myArg="\"hello\" \"world\"" echo "string is:" $myArg exit Which gives us, + myArg='"hello" "world"' + echo 'string is:' '"hello"' '"world"' string is: "hello" "world" + exit Line two shows what is actually passed to the command; bash has added single

How to escape single quotes in MySQL

依然范特西╮ 提交于 2019-11-26 13:20:13
How do I insert a value in MySQL that consist of single or double quotes. i.e This is Ashok's Pen. The single quote will create problems. There might be other escape characters. How do you insert the data properly? Put quite simply: SELECT 'This is Ashok''s Pen.'; So inside the string, replace each single quote with two of them. Or: SELECT 'This is Ashok\'s Pen.' Escape it =) See my answer to "How to escape characters in MySQL" Whatever library you are using to talk to MySQL will have an escaping function built in, e.g. in PHP you could use mysqli_real_escape_string or PDO::quote Rashmi Pandit

Nesting quotes in JavaScript/HTML

你说的曾经没有我的故事 提交于 2019-11-26 12:28:13
问题 How do you nest quotes in HTML beyond the second level? As far as I know, there are only 2 types of quotes - single(\') and double(\"). I am aware of escaping using slashes - you have to escape in the code but that escaping won\'t work at the browser level. What is the accepted method to get around something like the following? <p onclick=\"exampleFunc(\'<div id=\"divId\"></div>\');\">Some Text</p> That code prints to the browser: \');\">Some Text 回答1: You need to use proper escaping/encoding

Indirect variable assignment in bash

泪湿孤枕 提交于 2019-11-26 12:23:33
Seems that the recommended way of doing indirect variable setting in bash is to use eval : var=x; val=foo eval $var=$val echo $x # --> foo The problem is the usual one with eval : var=x; val=1$'\n'pwd eval $var=$val # bad output here (and since it is recommended in many places, I wonder just how many scripts are vulnerable because of this...) In any case, the obvious solution of using (escaped) quotes doesn't really work: var=x; val=1\"$'\n'pwd\" eval $var=\"$val\" # fail with the above The thing is that bash has indirect variable reference baked in (with ${!foo} ), but I don't see any such

HTML attribute with/without quotes

守給你的承諾、 提交于 2019-11-26 12:17:44
问题 Is there any difference between <iframe src=\"www.example.com\" width=100%></iframe> and <iframe src=\"www.example.com\" width=\"100%\"></iframe> I\'ve tried both and both seem to work, but I\'m asking just in case there\'s something I need to be careful with (like maybe units other than %, etc.) 回答1: It is all about the true validity of HTML markup. It's for what W3C (WWW Consortium) work for. Many things might work in HTML but they have to be validated in order to be more carefully

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

∥☆過路亽.° 提交于 2019-11-26 12:03:48
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 Source=.\mydestsource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;",computername=10.10.10.10,username=administrator,password=adminpass" Keith Hill When PowerShell sees a command starting with a string it just evaluates the string, that is, it typically echos it to the screen, for example: PS> "Hello World" Hello World If you want

Can JSON numbers be quoted?

独自空忆成欢 提交于 2019-11-26 11:24:43
问题 Can there be quotes around JSON numbers? In most of the search links, it seems that numbers do not \"require\" quotes. But, should the parsers accept both \"attr\" : 6 and \"attr\" : \"6\" ? If MyParser has a method getInt to get a number given the key, should MyParser.getInt(\"attr\") return 6 in both cases, or throw an exception in the latter case? 回答1: In JSON, 6 is the number six. "6" is a string containing the digit 6 . So the answer to the question "Can json numbers be quoted?" is

Who wrote this programing saying? “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” [closed]

*爱你&永不变心* 提交于 2019-11-26 11:04:50
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. I found this at somebody's blog, and it introduces as Rick Osborne's. But I google this, and other people says: Martin Golding's, John Woods' and Damian Conway's... Yes, Damian Conway used this quote in " Perl Best Practices " (2005) but Damian doesn't mention who wrote it. Does anybody know who the real author of this aphorism is? I thought ChrisW's research was right, and I tried to confirm it by doing the same thing. I found John Woods' name in 1991 in this thread: Usage of

Variable containing multiple args with quotes in Bash

非 Y 不嫁゛ 提交于 2019-11-26 10:31:32
问题 I generate a bash variable containing all my args and those args contain spaces. When I launch a command with those args - eg. ls $args - quotes are not correctly interpreted. Here is an example - also creating and erasing needed files. #!/bin/bash f1=\"file n1\" f2=\"file n2\" # create files touch \"$f1\" \"$f2\" # concatenate arguments args=\"\\\"$f1\\\" \\\"$f2\\\"\" # Print arguments, then launch \'ls\' command echo \"arguments :\" $args ls $args # delete files rm \"$f1\" \"$f2\" With