For the purposes of this question let's say I want to echo the following on the screen: 'single quote phrase' 'double quote phrase'. I'd like to escape single and double quotes while running a command under a different user. On Windows cmd the script needs to implement the globbing. You should stick to single quotes, unless you want to interpolate variables. I'm having trouble with escaping characters in bash. 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. 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. 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. There is no direct way to escape the single quotes whenever you want to encase them in a single-quoted string.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |