为什么我可以回显环境变量但不能将它用于 cd 或 ls?

Why can I echo an environment variable but not use it to cd or ls?

我怎么可以 echo $RUBYPATH 变量:

[grant@rails-box app]$ echo $RUBYPATH
/opt/rubies/ruby-2.3.0

ls那个目录:

[grant@rails-box app]$ ls /opt/rubies/ruby-2.3.0
bin  include  lib  share

但是我不能ls使用变量?

[grant@rails-box app]$ ls $RUBYPATH
: No such file or directoryes/ruby-2.3.0

Bishop 是对的:试试

$ echo $RUBYPATH | cat -v # or hexdump -C