Escaping double quotes with tcsh alias

后端 未结 5 686
轻奢々
轻奢々 2020-12-11 21:55

I\'m trying to run the following commands:

replace -x \"must \" A2input.txt
replace -x \" a\" -f -s ## A2input.txt
replace -x to -s ## -a A2input.txt
replace         


        
5条回答
  •  粉色の甜心
    2020-12-11 22:16

    tcsh has a newer variable backslash_quote. Not sure when it was added but it is supported in 6.18.01 (version on OS X El Capitan) and 6.19 (latest stable release at time of writing). This makes it possible to escape ', ", and ` inside of quotation marks.

    set backslash_quote
    
    set sentence = 'I\'m a little teapot.'
    set sentence2 = "The man said \"hello\""
    

    If you don't want to use this option, your choices are limited to using a different type of quote around the symbol

    "The man said "'"'"hello"'"'
    

    or not using quotes at all and liberally backslashing things.

    The\ man\ said\ \"hello\"
    

提交回复
热议问题