quotes

How to use an environment variable inside a quoted string in Bash

爷,独闯天下 提交于 2019-11-29 21:59:58
I've tried various forms of the following in a bash script: #!/bin/bash svn diff $@ --diff-cmd /usr/bin/diff -x "-y -w -p -W $COLUMNS" But I can't get the syntax to correctly expand the COLUMNS environment variable. I've tried various forms of the following: svn diff $@ --diff-cmd /usr/bin/diff -x '-y -w -p -W $COLUMNS' and svn diff $@ --diff-cmd /usr/bin/diff -x '-y -w -p -W ${COLUMNS}' and eval svn diff $@ --diff-cmd /usr/bin/diff -x "-y -w -p -W $COLUMNS" Suggestions? If unsure, you might use the 'cols' request on the terminal, and forget COLUMNS: COLS=$(tput cols) Just a quick note/summary

How to Insert Double or Single Quotes

眉间皱痕 提交于 2019-11-29 20:41:56
I have a long list of names that I need to have quotes around (it can be double or single quotes) and I have about 8,000 of them. I have them in Excel without any quotes and I can copy all of the names and paste them no problem but there are still no quotes. I have looked and looked for an Excel formula to add quotes to the name in each row but I have had no luck. I have also tried some clever find and replace techniques but no have worked either. The format I am looking for is this: "Allen" or 'Allen' Any of those would work. I need this so I can store the info into a database. Any help is

How to remove extra indentation of Python triple quoted multi-line strings?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 20:34:00
I have a python editor where the user is entering a script or code, which is then put into a main method behind the scenes, while also having every line indented. The problem is that if a user has a multi line string, the indentation made to the whole script affects the string, by inserting a tab in every space. A problem script would be something so simple as: """foo bar foo2""" So when in the main method it would look like: def main(): """foo bar foo2""" and the string would now have an extra tab at the beginning of every line. FlorianH So if I get it correctly, you take whatever the user

ASP.NET single quotes are converted to '

你说的曾经没有我的故事 提交于 2019-11-29 17:38:35
问题 Note: Most probably this will be a double question, but since I haven't found a clear answer, I'm asking it anyway. In ASP.NET I'd like to add some JavaScript to the onclick event of a CheckBox. I've simplified the case to this: <asp:CheckBox ID="TestCheckBox" runat="server" onclick="alert('test');" Text="Test" /> The resulting HTML is as follows: <input id="MainContainer_TestCheckBox" type="checkbox" name="ctl00$MainContainer$TestCheckBox" onclick="alert('test');" /><label for="MainContainer

Manage quotes inside string VBA

走远了吗. 提交于 2019-11-29 17:37:22
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? 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 Replace on the string using Chr(34) - the " character: str1 = Replace(str1, Chr(34), Chr(34)&Chr(34)) 来源:

unable to pass wget a variable with quotes inside the variable

会有一股神秘感。 提交于 2019-11-29 17:35:35
I am trying to script a wget command to download a web page and all it's attachments and jpegs etc. When I enter the script by hand, it works, but I need to run this over 35000 times to archive an old web site which is outside of my control (international company politics, but I'm the owner of the data). My problem has been in variablising the session parameters. My script so far is as follows: cnt=35209 # initialise the headers general_settings='-4 -P xyz --restrict-file-names=windows -nc --limit-rate=250k' html_page_specific='--convert-links --html-extension' proxy='--proxy-user=xxxxxx -

PHP Escaping Quotes Automatically When Using fwrite()

自闭症网瘾萝莉.ら 提交于 2019-11-29 16:41:02
PHP is automatically escaping my quotes before writing to a file using fwrite. I am trying to make a test code page. Here is the code I have: <?php if ($_GET['test'] == 'true') { $code = $_POST['code']; $file = fopen('testcode.inc.php', 'w+'); fwrite($file, $code); fclose($file); require_once('testcode.inc.php'); } else { echo " <form method='post' action='testcode.php?test=true'> <textarea name='code' id='code'></textarea><br><br> <button type='submit'>Test!</button><br> </form> "; } ?> When I enter the following into my form: <?php echo 'test'; ?> It gets saved in the file as: <?php echo \

Quotation marks in value of html tag attribute problem

◇◆丶佛笑我妖孽 提交于 2019-11-29 15:30:01
<?php $myname = 'my name have quotation marks " <- here'; ?> And i try to: <input type="text" name="newnameproposition[<?php echo $myname ?>]"> And html have a little problem becouse of: name="newnameproposition[my name have quotation marks " <- here]" Can anybody had this kind of problem? Take a look at htmlentities() 来源: https://stackoverflow.com/questions/4939193/quotation-marks-in-value-of-html-tag-attribute-problem

Are single quotes escaped automatically in PHP? Then what's the need for cleaning?

感情迁移 提交于 2019-11-29 15:20:43
I'm reading up on web security and one obvious topic to cover is SQL injections . I'm trying to set up a basic PHP page where I can execute an SQL injection (it's a local server). However, it seems my code (or server) automatically escapes single quotes. Is this a new standard or is there a setting that's activated on my server that I don't know about? Is there a need to clean input any more? Here's an example of my server side code: $foo = $_POST['foo']; $sql = "SELECT * FROM bar WHERE foo='" . $foo . "'"; connectoTo("database"); query($sql); Where connectTo() connects to the database server

Making a new line with single quotes?

寵の児 提交于 2019-11-29 15:19:18
Can I do a line break like this '\n' ? Or do I must use double quotes - "\n" ? You have to use double quotes. Otherwise, PHP will literally output \n . http://php.net/manual/en/language.types.string.php To output a newline (or any other control character for that matter) you must always use double quotes. An alternative to not use double quotes is chr() with the respective ASCII code as an argument: echo chr(10); // same as echo "\n"; Ashraf just add .PHP_EOL; to the end of your line using single quotes and you will have a new line No - \n in single quotes is '\n'. Yes - you have to use double