在 macOS 上安装了 lua,但是命令行无法识别

我在 macOS 上成功安装了 lua,但是当我运行 lua 命令时,却得到了“-bash: lua: command not found”的错误信息。尽管我可以通过 /usr/local/bin/lua 命令成功运行 lua,我也确认了 lua 安装的路径已经包含在 PATH 环境变量中。我记录了一些信息如下:

lxr:bin wang$ pwd

/usr/local/bin

lxr:bin wang$ echo $PATH

.;/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:JAVA_HOME/bin

lxr:bin wang$ lua

-bash: lua: command not found

lxr:bin wang$ pwd

/usr/local/bin

lxr:bin wang$ ls -l

total 872

-rwxr-xr-x 1 root wheel 80 11 23 00:40 VBoxAutostart

-rwxr-xr-x 1 root wheel 82 11 23 00:40 VBoxBalloonCtrl

-rwxr-xr-x 1 root wheel 80 11 23 00:40 VBoxBugReport

-rwxr-xr-x 1 root wheel 77 11 23 00:40 VBoxDTrace

-rwxr-xr-x 1 root wheel 79 11 23 00:40 VBoxHeadless

-rwxr-xr-x 1 root wheel 77 11 23 00:40 VBoxManage

-rwxr-xr-x 1 root wheel 79 11 23 00:40 VBoxVRDP

-rwxr-xr-x 1 root wheel 77 11 23 00:40 VirtualBox

lrwxr-xr-x 1 root wheel 14 3 28 2016 git -> ../git/bin/git

lrwxr-xr-x 1 root wheel 37 3 28 2016 git-credential-osxkeychain -> ../git/bin/git-credential-osxkeychain

lrwxr-xr-x 1 root wheel 24 3 28 2016 git-cvsserver -> ../git/bin/git-cvsserver

lrwxr-xr-x 1 root wheel 20 3 28 2016 git-shell -> ../git/bin/git-shell

lrwxr-xr-x 1 root wheel 26 3 28 2016 git-upload-pack -> ../git/bin/git-upload-pack

lrwxr-xr-x 1 root wheel 15 3 28 2016 gitk -> ../git/bin/gitk

-rwxr-xr-x 1 root wheel 221128 12 1 15:53 lua

-rwxr-xr-x 1 root wheel 150520 12 1 15:53 luac

-rwxr-xr-x 1 root wheel 2670 11 28 2014 pstorm

-rwxr-xr-x 1 root wheel 1394 3 8 2017 ssh-copy-id

-rwxr-xr-x 1 root wheel 75 11 23 00:40 vbox-img

-rwxr-xr-x 1 root wheel 77 11 23 00:40 vboxwebsrv

lxr:bin wang$ ./lua

Lua 5.3.0 Copyright (C) 1994-2015 Lua.org, PUC-Rio

>

lxr:bin wang$

点赞
用户107090
用户107090

在 $PATH 中的前两个字符应该是 .:,而不是 .;

2017-12-01 09:04:53