Getting quotes into an alias definition?

Erik Christiansen erik at dd.nec.com.au
Wed Oct 11 02:19:07 UTC 2006


On Tue, Oct 10, 2006 at 01:58:19PM +0100, Adam Funk wrote:
> Is it possible to get quotes into the definition of a bash alias?
> 
> I've tried a few things like this:
> 
>   alias foo='foo --option=\'*.txt\''
> 
>   alias foo="foo --option='*.txt'"
> 
> but haven't figured out a way that works.

If your alias is amenable to the shell's expansion rule for "", then you
can use '' where you really need it, and "" for the alias. (Well, it
works for me. I haven't checked the manual. :-) e.g.

alias v?="echo; grep -E '^alias v[a-z]+=' ~/.bashrc | sed -e 's/alias/ /' -e 's/=/ = /' | more"

Erik




More information about the ubuntu-users mailing list