Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to quote any script for use as an alias' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to quote any script for use as an alias
Authored by: loren_ryter on May 19, '06 06:44:46PM

hmm.. this is totally arcane but very useful. but how would you make it into a bash alias that would quote for other bash aliases?

i understand that a bash alias would look like:
alias qm='perl....'



[ Reply to This | # ]
A script to quote any script for use as an alias
Authored by: loren_ryter on May 19, '06 06:47:35PM

sorry, i should have added that I tried in my .bashrc file:

alias qm='perl\ \-we\ \'\$s\=\<\>\;print\ quotemeta\ \$s\'\'

but when i type "qm" in the bash shell I get:
-bash: syntax error near unexpected token `;'



[ Reply to This | # ]
bash style
Authored by: SOX on May 20, '06 08:41:05PM
you don't want to quote it.

alias qm=perl\ \-we\ \'\$s\=\<\>\;print\ quotemeta\ \$s\'  
[\code]


[ Reply to This | # ]