5

I am trying to run openscad from the command line and it throws an error, but if I type out the whole path reported by which it seems to work as shown below.

[dataproc@Euclid ~]$ which openscad
/usr/bin/openscad
[dataproc@Euclid ~]$ openscad
bash: /usr/local/bin/openscad: No such file or directory
[dataproc@Euclid ~]$ /usr/bin/openscad
[dataproc@Euclid ~]$ #this worked

I am totally clueless as to what is going on here, any help would be greatly appreciated.

2
  • 4
    What does type openscad produce? May 28, 2011 at 4:21
  • 1
    whats the output of echo $PATH
    – phoxis
    May 28, 2011 at 4:21

2 Answers 2

6

which lies; it can report things based on an idealized situation as gleaned from your shell startup files, while missing some possibilities and not catching any changes not made by the standard files. Use type to see what the shell really thinks is going on.

2@mress:1 B$ type which
which is /usr/bin/which

External commands simply can't tell what will really happen, because they have to guess at functions and aliases based on your startup files and won't know about things created by autoload mechanisms; you need to ask the shell itself what it will do.

2@mress:2 B$ type type
type is a shell builtin
10
  • Everything you wrote is correct, but didn't answer why his bash returning for the simple "openscad", "/usr/local/bin/openscad: No such file or directory".
    – kobame
    May 28, 2011 at 7:12
  • @kobame: neither I nor anyone else can know the answer without knowing the output of type openscad. Which is what I tried to explain; apparently I failed.
    – geekosaur
    May 28, 2011 at 7:16
  • [dataproc@Euclid ~]$ type openscad openscad is hashed (/usr/local/bin/openscad)
    – shawn
    May 28, 2011 at 14:54
  • I am not sure what "openscad is hashed" means but there was no alias for the command. Thank you all for the quick response.
    – shawn
    May 28, 2011 at 14:54
  • @shawn: Run hash -r and then type openscad again. Looks like it may have been in /usr/local/bin, got moved, and the shell didn't update its internal location hash.
    – geekosaur
    May 28, 2011 at 14:56
0

Without knowing your .profile (.bashrc, etc) only guessing, than you have somewhere

alias openscad=/usr/local/bin/openscad

and that is why your bash trying run /usr/local/bin/openscad and not the default one in /usr/bin.

You must log in to answer this question.