![]() For the purposes of this question let's say I want to echo the following on the screen: 'single quote phrase' 'double quote phrase'. There isnt any way to escape single quotes or anything else within single quotes. I'd like to escape single and double quotes while running a command under a different user. escaping single-quotes Yes, I know that I can write. On Windows cmd the script needs to implement the globbing. I'm having trouble with escaping characters in bash. Enclosing characters in single quotes preserves the literal value of each character within the quotes. I need a single escape to protect the * for the shell in order to test the globbing implementation of my script.īackground: My script shall run on Windows and Linux. IMHO, the real answer is that you can't escape single-quotes within single-quoted strings. Zsh: no matches found: /Users/tom/Documents/evaluate/data/\*.xml PS C:\Users\tom\Projekte\evaluate> & 'C:\Users\tom\AppData\Local\pypoetry\Cache\virtualenvs\evaluate-gzJA505A-p圓.8\Scripts\python.exe' 'c:\Users\tom\.vscode\extensions\ms-python.python-2045\pythonFiles\lib\python\debugpy\launcher' '64738' '-' 'C:\Users\tom\Projekte\evaluate/exec_evaluate.py' 'mine' evaluate % env /Users/tom/Library/Caches/pypoetry/virtualenvs/evaluate-i9NAUR7e-p圓.8/bin/python /Users/tom/.vscode/extensions/ms-python.python-2045/pythonFiles/lib/python/debugpy/launcher 49969 - /Users/tom/Documents/evaluate/exec_evaluate.py mine /Users/tom/Documents/evaluate/data/\\*.xmlīecause of the double escape the zsh doesn't find any files and fails before calling my script: Hover to view descriptions of existing attributes. Using a Backslash Character (\) to Escape Single Quotes in Bash In Bash scripting, one effective way to escape a single quote enclosed within a single-quoted string is to use a backslash character (\). Use IntelliSense to learn about possible attributes. In the first example, we used the dollar () symbol, while the second example shows the usage of multiple single quotes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |