[Novalug] alias

Jon LaBadie novalugml@jgcomp.com
Mon Jul 15 01:02:43 EDT 2013


On Mon, Jul 15, 2013 at 01:56:28PM +1200, Mark Smith wrote:
> looks like it was getting just a tad too complicated.  how about this?
> 
> 	alias uridec="perl -MURI::Escape -nle 'print uri_unescape($_)'"
> 

_ may be a valid shell variable so the $_ should be escaped as it is
inside shell double, not single quotes:

   alias uridec="perl -MURI::Escape -nle 'print uri_unescape(\$_)'"

Jon
> On Sun, Jul 14, 2013 at 09:35:16PM -0400, William Sutton wrote:
> > I believe, for starters, that an alias command has to be quoted.  For 
> > example, looking at my .bashrc, I have:
> > 
> > alias ls='ls -F -G'
> > alias ll='ls -l'
> > alias la='ls -a'
> > alias lla='ls -al'
> > 
> > Now, I tried playing around with your test command a bit, and have run 
> > into quote hell, so I'm going to leave the rest of the exercise to someone 
> > better schooled in shell scripting.
> > 
> > William Sutton
> > 
> > On Sun, 14 Jul 2013, shawn wilson wrote:
> > 
> > > Why isn't this working as an alias?
> > >
> > > alias uridec=perl -MURI::Escape -nle '\''print uri_unescape($_)'\'''
> > >
> > > if i do:
> > > echo stuff | perl -MURL::Escape -nle 'print uri_unescape($_)'
> > > it works fine, so the perl is good. There's just some issue with
> > > escaping or using $_ there but I can't figure out what?
> > >
> > > BTW, this is zsh if that matters (it shouldn't but...).
> 
> -- 
> Hei konā mai
> Mark Smith
> mark@winksmith.com
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug
>>> End of included message <<<

-- 
Jon H. LaBadie                  novalugml@jgcomp.com
 11226 South Shore Rd		(703) 787-0688 (H)
 Reston, VA  20190		(609) 477-8330 (C)



More information about the Novalug mailing list