2

I'm trying to do the simplest of shell aliases like I always use to do.

Here's my .bashrc (and same happened with ZSH and .zshrc) for instance :

alias ll=“ls -al”
alias edit_http=“open -e /etc/httpd/conf/httpd.conf”

and here's my $PATH variable :

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

When I open a new terminal window I get this :

-bash: alias: -al”: not found
-bash: alias: -e: not found
-bash: alias: /etc/httpd/conf/httpd.conf”: not found

Here's my ls -al result of .bashrc :

-rwxr-xr-x@   1 ed    staff     78 Mar 17 03:55 .bashrc

Strangely I can type this into Terminal and it works :

alias ll="ls -al"

But not from within the .bashrc file.

Any suggestions ? I've checked so many forum entries and nothing worked so far.

0

1 Answer 1

4

It looks like something went wrong during copying the alias into your .bashrc.

You ended up with 'wrong' quotation mark. Replace with "and it should work. is unicode but you require ascii quotation marks. For testing you can use this .bashrc

# bashrc example
# won't work
alias ll=“ls -al”
# will work
alias la="ls -al"

And with this code you can verify your problem:

$ source .bashrc
-bash: alias: -al”: not found
$ ll
-bash: “ls: command not found
$ la
total 0
drwxr-xr-x   2 alneuman  staff    68 Mar 17 12:18 .
drwxrwxrwx+ 70 alneuman  staff  2380 Mar 17 12:18 ..

Have a look here at unix.stackexchange. Somebody had the same issue. Brave new unicode world ;)

Sign up to request clarification or add additional context in comments.

1 Comment

That was it. Thanks so much! Your post allowed me to see what was happening. I was using "open -e" and TextEdit to edit the .bashrc file and the Substitutions - Smart Quotes was ON. Once I turned it OFF everything worked fine. Success!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.