gh4x
gh4x

Reputation: 820

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

How come I can echo the $RUBYPATH variable:

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

And ls that directory:

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

But I can't ls using the variable?

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

Upvotes: 1

Views: 164

Answers (1)

James K. Lowden
James K. Lowden

Reputation: 7837

Bishop is right: try

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

Upvotes: 3

Related Questions