4

I'm getting nuts with this...

I want to be able to open the application "Jupyter Notebook" with a one line .sh script (that I have made executable) that simply says:

jupyter notebook

If I put this line directly in Terminal, it works. If I drag and drop the .sh script to Terminal, and hit enter, it works. But if I run the script from Nautilus and say "Run in Terminal" you see Terminal opening for the fraction of a second, and then nothing happens.

Help is much appreciated. Best, Khalo

//edit

I added "/bin/bash" to the end of the script, and now Terminal stays open, and I am able to see the error message that says:

"/path_to_script/script.sh: 1: /path_to_script/script.sh: jupyter: not found"

Isn't this weird? As I said before, if typed directly into Terminal it works!

  • 2
    What if you replace your script with these two lines instead? #!/bin/bash jupyter notebook & disown - does that change anything? – Byte Commander Jul 2 '16 at 13:23
  • What if you move your script straight to your home directory and then do the same thing? – anonymous2 Jul 2 '16 at 13:28
  • @ByteCommander Error message changes slightly to: "/path_to_script/script.sh: 3: jupyter: command not found" – Khalo Jul 2 '16 at 13:30
  • @anonymous2 Didn't help unfortunately. – Khalo Jul 2 '16 at 13:31
  • 2
    Where was the script before hand? What was the path to it? – anonymous2 Jul 2 '16 at 13:43
3

Use this instead:

#!/bin/bash
/home/$USER/.local/bin/jupyter notebook

or

#!/bin/bash
/usr/local/bin/jupyter notebook

If that still doesn't work, replace the path to jupyter with the output of the following command:

which jupyter
  • 1
    wouldn't which be more effective in this case? I get no path results with whereis on a known script, but which returns the full path to it's location in ~/bin... – Elder Geek Jul 2 '16 at 14:34
  • This looks quite probable from my reading on the question. – anonymous2 Jul 2 '16 at 14:38
  • @ElderGeek Jupyter installs with pip locally and returns a full path but it still won't run in nautilus like that. I have updated the script and I will look into which next time something like this comes up. Thanks. – mchid Jul 2 '16 at 14:39
  • I updated the script again as there was a typo. It should have $USER. – mchid Jul 2 '16 at 14:40
  • @mchid Your most welcome. – Elder Geek Jul 2 '16 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.