2

I am very new to bash. All I want to do is run this nvvp -vm /usr/lib64/jvm/jre-1.8.0/bin/java without having to remember the path at the end. I figured the instafix would be to just do this...

nvvp() {
    nvvp -vm /usr/lib64/jvm/jre-1.8.0/bin/java
}

Then I could just call nvvp and it would boot up Nvidia's Visual Profiler. But this just crashes my terminal.

1
  • Shellcheck automatically detects this and other common issues Commented Sep 19, 2021 at 17:40

3 Answers 3

4

The redefinition of nvvp is global. Inside the function nvvp you execute that very same function, causing an infinite recursion. To call the actual binary instead of the function, use bash's command built-in:

nvvp() {
    command nvvp -vm /usr/lib64/jvm/jre-1.8.0/bin/java
}
Sign up to request clarification or add additional context in comments.

Comments

3

It look's like a fork. Try out

another_name() {
nvvp -vm /usr/lib64/jvm/jre-1.8.0/bin/java
}

1 Comment

Ahh, that fixed it thanks!
0

Another option would be to define an alias, eg:

alias nvvp='nvvp -vm /usr/lib64/jvm/jre-1.8.0/bin/java'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.