Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question [SOLVED] [Bash] How to include quote?


    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:

    # 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
    alias lld='ls -l | egrep '^d''
    Works for me.

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

  3. #3
    Linux Newbie
    Join Date
    Sep 2004
    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

    alias lld="ls -l | egrep '^d'"
    In a world without walls and fences, who needs Windows and Gates?

  4. $spacer_open
  5. #4
    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