Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #25: Adding capability to set JAVA_HOME for jvm in use #26

Merged
merged 1 commit into from
Oct 21, 2016

Conversation

techieBrandon
Copy link
Contributor

No description provided.

@techieBrandon
Copy link
Contributor Author

It is probably worth pointing out that the script really has this wrong, although this is very common.

The ‘which’ command is not portable. It originally came from CSH, and made its way into TCSH as well. It is an external command, and does something relatively useful – but on non-Linux OS’s, this usually begins with alias expansion taken directly from the user’s .cshrc file – which is generally not applicable when using another shell. People started using it while ignoring this fact. Of course, on Linux, which arrived after most of this history, ‘which’ also does something completely different – it locates commands using the BASH algorithms, again completely inappropriate if the shell is something else (even BASH running as /bin/sh).

The portable POSIX equivalent utility is ‘command –v ’, which is a built-in in all POSIX shells, and therefore will locate commands in the same manner as the current shell. You can also ensure you get the ‘default’ variant of a command by invoking it using ‘command –p’, which ignores aliases and the current PATH, using the system-defined default PATH to locate the command (if available).

@skhatri skhatri merged commit 5a671b0 into skhatri:master Oct 21, 2016
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.

2 participants