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 -x faith -f "unequivocal" A2input.txt
And it'd be nice if I could just alias it to something short and simple like "a", "b", "c", "d", etc...
However, some of those arguments have a quote, which is messing up the alias. Does anyone know how to actually escape the double quotes? I've tried things like '\"' and \" but nothing seems to work.
I'm using tcsh as my shell.
The following all work in tcsh
to accomplish various results:
alias t echo hello world # you may not actually need any quotes alias u 'echo "hello world"' # nested quotes of different types alias v echo\ \"hello\ world\" # escape everything alias w echo '\;'hello'";"' world # quote/escape problem areas only alias x 'echo \"hello world\"' # single quote and escape for literal " alias y "echo "\""hello world"\" # unquote, escaped quote, quote ("\"") alias z 'echo '\''hello world'\' # same goes for single quotes ('\'')
To see how these are interpreted by the shell, run alias
with no arguments:
% alias t (echo hello world) u echo "hello world" v echo "hello world" w (echo \;hello";" world) x echo \"hello world\" y echo "hello world" z echo 'hello world'
Anything in parentheses is run in a subshell. This would be bad if you're trying to set environment variables, but mostly irrelevant otherwise.
Finally, here's what the examples actually do:
% t; u; v; w; x; y; z hello world hello world hello world ;hello; world "hello world" hello world hello world