Results 1 to 4 of 4
Hello
I've been Googling for this for over half an hour, and still can't get this alias to work :-/
I'd like to add an alias "lld" to only list ...
- 08-05-2010 #1Linux Newbie
- Join Date
- Nov 2007
- Posts
- 127
[SOLVED] [Bash] How to include quote?
Hello
I've been Googling for this for over half an hour, and still can't get this alias to work :-/
I'd like to add an alias "lld" to only list directories:
I make sure I log off and log back on, but I'm still getting "No command 'lld' found, did you mean:".Code:# cat /etc/bash.bashrc [...] #BAD alias lld = 'ls -l | egrep '^d'' #BAD alias lld = 'ls -l | egrep \'^d\'' #BAD alias lld = "ls -l | egrep '^d'" #BAD alias lld = "ls -l | egrep \'^d\'" #BAD alias lld = "ls -l | egrep '\'^d'\'"
Does someone know how to add an alias that includes a quote, or an alternative to eqrep that doesn't require quotes altogether?
Thank you.
- 08-05-2010 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
Works for me.Code:alias lld='ls -l | egrep '^d''
I edited the file, saved, and then sourced it:
Code:source /etc/bash.bashrc
- 08-05-2010 #3Linux Newbie
- Join Date
- Sep 2004
- Location
- UK
- Posts
- 160
As HROAdmin26 say's it works the extra space round the = is the problem.
If you want to preserve the quotes round the ^d then
try
Code:alias lld="ls -l | egrep '^d'"
In a world without walls and fences, who needs Windows and Gates?
- 08-06-2010 #4Linux Newbie
- Join Date
- Nov 2007
- Posts
- 127
Thanks guys. I didn't know Bash would barf because of extra spaces between/after the "=" sign, and without being explicit about it :-/


