quotes

How to pass quoted parameters to another program

依然范特西╮ 提交于 2019-12-20 04:19:52
问题 In a bash script, I need to pass a parameter to another program. The parameter has spaces in so must be quoted. Everything works fine in this simple case 1: /bin/echo /some/command --param="abc def ghi" Output: /some/command --param=abc def ghi The problem begins if I want to make the bash script more sophisticated, somehow the parameter value has changed in case 2 and 3: FOO="ghi" DEFAULTS="--param=\"abc def $FOO\"" /bin/echo /some/command $DEFAULTS DEFAULTS='--param="abc def '$FOO'"' /bin

Grep error due to expanding variables with spaces

妖精的绣舞 提交于 2019-12-20 01:36:08
问题 I have a file called " physics 1b.sh ". In bash, if I try x="physics 1b" grep "string" "$x".sh grep complains: grep: physics 1b: No such file or directory. However, when I do grep "string" physics\ 1b.sh It works fine. So I guess the problem is something to do with the variable not being expanded to include the backslash that grep needs to recognize the space. How do I get this to work? Using bash 3.2, mac os 10.6. Edit: Never mind, the problem was that x was set to " physics 1b" , but when I

Using quote inside strings in Delphi [duplicate]

我们两清 提交于 2019-12-19 12:24:57
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How does one escape characters in Delphi string In Delphi a string is contained within a pair of ' but I need to use ' in my string... and when I use one it brings a end to the entire string identification. 'inside string ' but this bit is outside' inside again' and the end Is there some symbol that removes the coding affect of the next character? 回答1: You need another quote to escape a quote: Writeln('I''m in

IntelliJ IDEA braces, brackets and quotes customize color highlighting

坚强是说给别人听的谎言 提交于 2019-12-19 05:05:01
问题 How to change color of brackets when they are selected ? 回答1: Go over to Settings, and then just go to this menu: 回答2: Maybe the plugin HighlightBracketPair is suitable for you. The plugin will highlight the most left and most right brace pair for you when you move the caret, and you can custom the color the effect. Java Highlight Go Highlight Config Page 回答3: File => Settings => Editor => Color Scheme => General => Code => Matched brace 来源: https://stackoverflow.com/questions/21259635

Escape backquote in a double-quoted string in shell

╄→гoц情女王★ 提交于 2019-12-18 13:53:27
问题 For the command: /usr/bin/sh -c "ls 1`" (a backquote after 1). How to make it run successfully? Adding a backslash before "`" does not work. ` is a special char as we know, and I tried surrounding it with single quote too (/usr/bin/sh -c "ls 1'`'"), but that doesn't work either. The error always are: % /usr/bin/sh -c "ls 1\`" Unmatched ` 回答1: You need to escape the backtick, but also escape the backslash: $ touch 1\` $ /bin/sh -c "ls 1\\\`" 1` The reason you have to escape it "twice" is

How to read quoted text containing escaped quotes

喜你入骨 提交于 2019-12-18 11:30:35
问题 Consider the following comma separated file. For simplicity let it contain one line: 'I am quoted','so, can use comma inside - it is not separator here','but can\'t use escaped quote :=(' If you try to read it with the command table <- read.csv(filename, header=FALSE) the line will be separated to 4 parts, because line contains 3 commas. In fact I want to read only 3 parts, one of which contains comma itself. There quote flag comes for help. I tried: table <- read.csv(filename, header=FALSE,

Manage quotes inside string VBA

♀尐吖头ヾ 提交于 2019-12-18 09:49:08
问题 I trying to insert to Access Table some values that I getting from another table, the problem is that some values comes with quotes and double quotes inside the string, like this example: str1 = "Non-fusible sectionalizing "green' low rise switch." How can I manage quotes inside string in VBA for Access 2010 for can insert it into table? 回答1: From memory I think you just need to double them up to look like this: str1 = "Non-fusible sectionalizing ""green' low rise switch." You can perform a

Force repr() to use single quotes

五迷三道 提交于 2019-12-18 06:48:46
问题 I have a question, is there a way to "force" repr() to create always single quotes around a string? This happens when I only use repr() print repr("test") 'test' print repr("test'") "test'" print repr("test\"") 'test"' print repr("test'\"") 'test\'"' so the last one actually does, what I want, but I don't want to add always \\" to get the single quotes. Edit: I am not going to mark an answer as accepted since, as pointed out by @martijn-pieters, I was using repr() for purposes it is not

passing quoted arguments from batch file to `powershell start` - self-elevation on demand

允我心安 提交于 2019-12-18 04:23:14
问题 I am writing a Windows batch file that automatically escalates itself to administrative permissions, provided the user clicks "Yes" on the User Access Control dialog that appears. I am using a technique I learned here to detect whether we already have admin rights and another from here to escalate. When appropriate, the following script, let's call it foo.bat , re-launches itself via a powershell-mediated call to runas : @echo off net session >NUL 2>NUL if %ERRORLEVEL% NEQ 0 ( powershell

Java Regex for matching quoted string with escaped quotes

妖精的绣舞 提交于 2019-12-18 03:39:31
问题 I know there are already many questions like mine but I found no answer which works in Java. So I write a new question. I have text files with content like this: key1 = "This is a \"test\" text with escapes using '\\' characters"; key2 = 'It must work with \'single\' quotes and "double" quotes'; I need a regular expression which matches the values in the double-quotes (or single-quotes). This regular expression must support the escaped quotes and escaped backslashes. The regular expression