Skip to content

Conversation

@muxator
Copy link

@muxator muxator commented Dec 13, 2016

With this change jvmtop.sh can be symlinked in a directory in the PATH and called from anywhere.

$  ls -l /usr/local/bin/jvmtop.sh
lrwxrwxrwx 1 root root 32 Dec 13 21:46 /usr/local/bin/jvmtop.sh -> /opt/jvmtop with space/jvmtop.sh

Before the change:

$ jvmtop.sh
Error: Could not find or load main class com.jvmtop.JvmTop

After the change it works, even if the script is a symlink, and if spaces are contained in the path.

Source for the change:
http://stackoverflow.com/questions/59895/getting-the-current-present-working-directory-of-a-bash-script-from-within-the-s#comment54598418_246128

With this change jvmtop.sh can be symlinked in a directory in the PATH and called from anywhere.

#  ls -l /usr/local/bin/jvmtop.sh
lrwxrwxrwx 1 root root 32 Dec 13 21:46 /usr/local/bin/jvmtop.sh -> /opt/jvmtop with space/jvmtop.sh

Before the change:
# jvmtop.sh
Error: Could not find or load main class com.jvmtop.JvmTop

After the change it works, even if the script is a symlink, and if spaces are contained in the path.

Source for the change:
http://stackoverflow.com/questions/59895/getting-the-current-present-working-directory-of-a-bash-script-from-within-the-s#comment54598418_246128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant