LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-27-2019, 12:52 PM   #1
petersonflake
LQ Newbie
 
Registered: Dec 2019
Posts: 1

Rep: Reputation: Disabled
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.
 
Old 12-27-2019, 01:07 PM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 15,637

Rep: Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125Reputation: 5125
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:~$

Last edited by pan64; 12-27-2019 at 01:24 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab not executing my shell script its executing standlaone atulkvtiwari Linux - Newbie 15 12-04-2018 07:25 AM
Problems executing perl script with inputs when executing under other perl scripts TheStr3ak5 Programming 4 04-22-2017 05:07 AM
Will Manjaro Linux Net edition act like Manjaro or a base install of Arch? punchy71 Linux - Newbie 4 06-28-2014 09:05 AM
CGI Scripts not executing Mr_Oz Linux - Enterprise 7 04-18-2006 04:21 PM
CGI Scripts not executing, pls help john_d13 Linux - General 3 12-22-2004 03:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration