LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scripts not executing Manjaro Linux (https://www.linuxquestions.org/questions/linux-newbie-8/scripts-not-executing-manjaro-linux-4175666625/)

petersonflake 12-27-2019 12:52 PM

scripts not executing Manjaro Linux
 
Hello,

First post so apologies in advance if there is any missing information.

I'm having a problem getting scripts to execute. When I check my path, with echo $PATH, I get the following output, showing that ~/.local/bin is in my path.

/home/petersonflake/.local/bin:/home/petersonflake/.cargo/bin:/home/petersonflake/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/petersonflake/goprojects/bin:/home/petersonflake/src/rtags/bin

There, I have the following script:

Code:

#!/usr/bin/env bash
echo "hello world"

I used chmod +x to make the script executable.

When I run ./test, the script executes. When I run test, no error is output, but nothing happens. However, when I rename test to test.sh, and type test.sh, the script runs as expected. I suspect there is a problem with my shebang, but I don't know how to fix it.

I have tried #!/usr/bin/bash, #!/usr/bin/env sh #!/usr/bin/sh #!/bin/bash #!/bin/env sh and so on.

Has anyone encountered this before? These same steps worked as expected on other distributions.

pan64 12-27-2019 01:07 PM

because there is an app named test, also there is a shell builtin named test. You need to choose another name.
Code:

user@host:~$ which test
/usr/bin/test
usr@host:~$ type test
test is a shell builtin
usr@host:~$



All times are GMT -5. The time now is 02:27 AM.