Cannot execute shell scripts

I have a very simple shell script I wrote to launch my web browser from the terminal (long story), run-brave.sh;

#!/bin/sh
brave

I’ve marked it as executable with chmod +x, but when attempting to run it, nothing happens. I’ve also tried replacing the first line with #!/bash/bin which I’ve used previously and that didn’t work either.

I’ve used this exact format of script on Ubuntu and had no issues. I was able to make several scripts to launch different programs, all worked with a simple double click. I’m still very new to Manjaro so I’m sure there’s something simple I’m missing, but when looking up how to run a program via shell scripts on Manjaro, I couldn’t find anything. If anyone could point me in the right direction I’d be grateful.

It should be #!/bin/bash (and not #!/bash/bin) but I guess it doesn’t solve your problem.

A script with the content posted here and marked executable is perfectly fine and will work.

Why do you need a scipt file to start that browser in the first place?
Just type brave (which is even shorter than your script name) to have the same effect.

3 Likes

Welcome to the forum! :wink:

Now why on Earth would you try launching Brave from a shell script? :astonished:

Unlike in Microsoft Windows, the current working directory is not part of the ${PATH}, which is an environment variable containing a colon-separated list of directories that the shell will look in for executables if the command you issued is not a shell builtin.

In Arch and Manjaro, you should put your shell scripts in ${HOME}/.local/bin, which is in the ${PATH}.

But ─ as has been said before ─ there is no need to create a shell script in order to launch Brave. Just enter it at the command prompt.

1 Like

better yet just create a keyboard shortcut.

While I agree, that starting brave via bash script seems be odd, we all started somewhere with our scripts. I‘m sure I have a bunch if scripts more experienced users will shake their head about, but they made perfect sense to me at the time.
So let‘s just stay relaxed with each other.

:laughing:
i still shack my head at some of my scripts, i’ll do the face palm, then say to myself " i must have been tired ".

2 Likes

I learned that the solution often lies in the error-message :wink:
So what is the error-message you get, when you start your script from a terminal ?

i had issues running a startup scrip;
this is how i managed to make it work