Find the answer to your Linux question:
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Nov 2007
    Posts
    127

    Question [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:

    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'\'"
    I make sure I log off and log back on, but I'm still getting "No command 'lld' found, did you mean:".

    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.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,756
    Code:
    alias lld='ls -l | egrep '^d''
    Works for me.

    I edited the file, saved, and then sourced it:
    Code:
    source /etc/bash.bashrc

  3. #3
    Linux Newbie
    Join Date
    Sep 2004
    Location
    UK
    Posts
    161
    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?

  4. #4
    Linux 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 :-/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •