4

I noticed that this does not work:

/tomcatDirectory/bin $ startup.sh //command not found

but this does work

/tomcatDirectory $ bin/startup.sh

I am used to Windows. It seems counter-intuitive to me that I can not run a program from its working directory, only from the parent folder.

What's the bigger picture of what's happening here?

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
bernie2436
  • 6,655

2 Answers2

7

The current directory (i.e., .) is not in your path. Try with

./startup.sh

You can check your path with

echo ${PATH}

You could add the current directory (.) to your path but this is considered a risk (especially if . is before other directories): when typing a command the shell will first try to execute it in the current directory. This will execute what is there instead of the default one.

Summarizing: just start executables in the current directory with ./ in front of them.

Matteo
  • 9,796
  • 4
  • 51
  • 66
0

Because "startup.sh" doesn't really look like a path to file and you don't have . in your PATH environment variable. But still you can start it as ./startup.sh

gelraen
  • 6,737