3 ms·
Note that you can precede the !:q with `echo` to see the result as well as the invocation without an error. $ echo !:q echo '# This string '\''has single'\
by emmelaich 6y ago
Note that you can precede the !:q with `echo` to see the result as well as the invocation without an error.
$ echo !:q
echo '# This string '\''has single'\'' "and double" quotes
and a $'
# This string 'has single' "and double" quotes and a $
- eMSF 6y agoSeeing the result of a modified history expansion is (or was) kind of a desired feature, so it's built-in just like the ability to escape stuff with :q $ # here be quote ' " chars (use :p to print but not execute) $ :!q:p '# here be quote '\'' " chars' (use :s to modify – no :q here because we modify the already quoted text !!, unquoted is now !-2) $ !:s/be/are/:p '# here are quote '\'' " chars'
- slobiwan 6y agoThis is very useful for saving off a one-liner .sh file once you've finally gotten the one that you want to work. I will have to remember this! echo !:q > doagain.sh