0

system says the latest version of gfortran has been installed when I retry the sudo command, but then i still get the command not found error for gfortran. I'm guessing it's something to do with the directory?

I'm using a virtual machine to emulate 29~20.04.1-Ubuntu. The command:

gfortran hello.f90 -o hello

and the error:

gfortran: Command not found.

When I use sudo apt-get install gfortran, i get: gfortran is already the newest version (4:9.3.0-1ubuntu2).

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
antonia
  • 1
  • 1
  • 1
    If you use `bash` run `hash -r`. If you use `zsh` run `rehash`. Then try again. Does that fix it? (Or, just open a new terminal and try again.) – Kusalananda Aug 22 '21 at 11:16
  • Possible duplicate: [How do I clear Bash's cache of paths to executables?](https://unix.stackexchange.com/q/5609) – Kusalananda Aug 22 '21 at 11:22
  • it is fixed, thank you for your time! – antonia Aug 22 '21 at 11:32
  • Interesting... so the shell hashes *empty* entries? I thought it only hashed things that were previously located (resulting in errors like `/old/path/to/file: no such file or directory`) – steeldriver Aug 22 '21 at 13:53
  • @steeldriver The `zsh` shell discovers executable on shell startup (after executing one external utility), and then you can force it to do re-scan with `rehash`. If you install something new without rehashing, it will not pick it up. – Kusalananda Aug 22 '21 at 14:32
  • @steeldriver _On the other hand_, the error message would be prefixed by the shell's name, not by `gfortran`. If it's not a shell hashing issue (and therefore a dupe), it's off-topic (problem went away). – Kusalananda Aug 22 '21 at 14:36

0 Answers0