AWK/shell quoting (was: Re: Access to UNIX-Related Publications)
brnstnd at stealth.acf.nyu.edu
brnstnd at stealth.acf.nyu.edu
Mon Jan 8 08:57:35 AEST 1990
(Steve, perhaps my quote and makealias aliases should be in the FAQ list?)
The problem is to feed awk the program
BEGIN {print "'"}
from csh. Those not yet sufficiently experienced to simply write down a
solution can use my quote alias:
% quote
BEGIN {print "'"} (you type this)
^D
'BEGIN {print "'\''"}'
So
% awk 'BEGIN {print "'\''"}'
works.
And the aliases, in one of my login files:
a quote "/bin/sed 's/\\!/\\\\\!/g' |
/bin/sed 's/'\\\''/'\\\'\\\\\\\'\\\''/g' |
/bin/sed 's/^/'\''/' |
/bin/sed 's/"\$"/'\''/'"
a makealias "quote | /bin/sed 's/^/alias \!:1 /' \!:2*"
a is aliased to alias. The quote alias should be all on one line. (On
most machines, you can replace the multiple sed by a single sed with
multiple -e's; unfortunately, this isn't as portable.) quote converts
its input into a csh-compatible quoted output. If you've just typed an
amazing command and want to save it as an alias ``foo'', type
% makealias foo > addto.login
(retype the command here and type ^D)
If addto.login looks okay, add it to .login. Or use >>.login directly.
---Dan
More information about the Comp.unix.wizards
mailing list