Executable file is in $PATH but won't run












1















I have a file in $HOME/bin (before you ask, yes, it is in my path) called test which I've confirmed can be executed fine when I run it with the full path to the file. However, I get a really weird issue when I don't run it this way. When I just run test in the terminal, it doesn't do anything and returns immediately. I know that this isn't an issue of finding the file for several reasons:




  1. There is no error message. Normally if the file can't be found or can't be executed a message will be printed out saying so.


  2. Running which test still returns the correct file path.


  3. Probably the weirdest of all - the script works fine when run through strace. I tried using strace to see if I could figure out what was going on but when I ran it with strace, it worked as expected with 0 issues.











share|improve this question







New contributor




ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Use type, not which. See Why not use “which”? What to use then?

    – wjandrea
    1 hour ago


















1















I have a file in $HOME/bin (before you ask, yes, it is in my path) called test which I've confirmed can be executed fine when I run it with the full path to the file. However, I get a really weird issue when I don't run it this way. When I just run test in the terminal, it doesn't do anything and returns immediately. I know that this isn't an issue of finding the file for several reasons:




  1. There is no error message. Normally if the file can't be found or can't be executed a message will be printed out saying so.


  2. Running which test still returns the correct file path.


  3. Probably the weirdest of all - the script works fine when run through strace. I tried using strace to see if I could figure out what was going on but when I ran it with strace, it worked as expected with 0 issues.











share|improve this question







New contributor




ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Use type, not which. See Why not use “which”? What to use then?

    – wjandrea
    1 hour ago
















1












1








1








I have a file in $HOME/bin (before you ask, yes, it is in my path) called test which I've confirmed can be executed fine when I run it with the full path to the file. However, I get a really weird issue when I don't run it this way. When I just run test in the terminal, it doesn't do anything and returns immediately. I know that this isn't an issue of finding the file for several reasons:




  1. There is no error message. Normally if the file can't be found or can't be executed a message will be printed out saying so.


  2. Running which test still returns the correct file path.


  3. Probably the weirdest of all - the script works fine when run through strace. I tried using strace to see if I could figure out what was going on but when I ran it with strace, it worked as expected with 0 issues.











share|improve this question







New contributor




ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have a file in $HOME/bin (before you ask, yes, it is in my path) called test which I've confirmed can be executed fine when I run it with the full path to the file. However, I get a really weird issue when I don't run it this way. When I just run test in the terminal, it doesn't do anything and returns immediately. I know that this isn't an issue of finding the file for several reasons:




  1. There is no error message. Normally if the file can't be found or can't be executed a message will be printed out saying so.


  2. Running which test still returns the correct file path.


  3. Probably the weirdest of all - the script works fine when run through strace. I tried using strace to see if I could figure out what was going on but when I ran it with strace, it worked as expected with 0 issues.








bash shell-script path executable strace






share|improve this question







New contributor




ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









ContronThePandaContronThePanda

61




61




New contributor




ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






ContronThePanda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Use type, not which. See Why not use “which”? What to use then?

    – wjandrea
    1 hour ago





















  • Use type, not which. See Why not use “which”? What to use then?

    – wjandrea
    1 hour ago



















Use type, not which. See Why not use “which”? What to use then?

– wjandrea
1 hour ago







Use type, not which. See Why not use “which”? What to use then?

– wjandrea
1 hour ago












1 Answer
1






active

oldest

votes


















9














test is an unfortunate name to use, it's the standard utility for conditional tests. (It's actually the same command as the [ in if [ ... ], it just looks like a syntactical thing, but is really just a normal command.)



test is also builtin in e.g. Bash, so running just test never looks up your binary from the path.



bash$ help test | head
test: test [expr]
Evaluate conditional expression.

Exits with a status of 0 (true) or 1 (false) depending on
the evaluation of EXPR. Expressions may be unary or binary.
[...]


test with no arguments just returns 1 (false).



Running strace test doesn't involve the shell builtin, since strace doesn't implement any utilities itself. It just uses what it finds in your PATH. Note that you probably have the standard test in /bin/test or /usr/bin/test, so if that would be first in PATH, strace would run run that.



On my Bash, which is also an external command, so it doesn't have an idea about builtins either. On the other hand, the type command is builtin to the shell, and type test would show that test is a shell builtin.






share|improve this answer


























  • Have an anecdote from 1985.

    – JdeBP
    3 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






ContronThePanda is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498685%2fexecutable-file-is-in-path-but-wont-run%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









9














test is an unfortunate name to use, it's the standard utility for conditional tests. (It's actually the same command as the [ in if [ ... ], it just looks like a syntactical thing, but is really just a normal command.)



test is also builtin in e.g. Bash, so running just test never looks up your binary from the path.



bash$ help test | head
test: test [expr]
Evaluate conditional expression.

Exits with a status of 0 (true) or 1 (false) depending on
the evaluation of EXPR. Expressions may be unary or binary.
[...]


test with no arguments just returns 1 (false).



Running strace test doesn't involve the shell builtin, since strace doesn't implement any utilities itself. It just uses what it finds in your PATH. Note that you probably have the standard test in /bin/test or /usr/bin/test, so if that would be first in PATH, strace would run run that.



On my Bash, which is also an external command, so it doesn't have an idea about builtins either. On the other hand, the type command is builtin to the shell, and type test would show that test is a shell builtin.






share|improve this answer


























  • Have an anecdote from 1985.

    – JdeBP
    3 hours ago
















9














test is an unfortunate name to use, it's the standard utility for conditional tests. (It's actually the same command as the [ in if [ ... ], it just looks like a syntactical thing, but is really just a normal command.)



test is also builtin in e.g. Bash, so running just test never looks up your binary from the path.



bash$ help test | head
test: test [expr]
Evaluate conditional expression.

Exits with a status of 0 (true) or 1 (false) depending on
the evaluation of EXPR. Expressions may be unary or binary.
[...]


test with no arguments just returns 1 (false).



Running strace test doesn't involve the shell builtin, since strace doesn't implement any utilities itself. It just uses what it finds in your PATH. Note that you probably have the standard test in /bin/test or /usr/bin/test, so if that would be first in PATH, strace would run run that.



On my Bash, which is also an external command, so it doesn't have an idea about builtins either. On the other hand, the type command is builtin to the shell, and type test would show that test is a shell builtin.






share|improve this answer


























  • Have an anecdote from 1985.

    – JdeBP
    3 hours ago














9












9








9







test is an unfortunate name to use, it's the standard utility for conditional tests. (It's actually the same command as the [ in if [ ... ], it just looks like a syntactical thing, but is really just a normal command.)



test is also builtin in e.g. Bash, so running just test never looks up your binary from the path.



bash$ help test | head
test: test [expr]
Evaluate conditional expression.

Exits with a status of 0 (true) or 1 (false) depending on
the evaluation of EXPR. Expressions may be unary or binary.
[...]


test with no arguments just returns 1 (false).



Running strace test doesn't involve the shell builtin, since strace doesn't implement any utilities itself. It just uses what it finds in your PATH. Note that you probably have the standard test in /bin/test or /usr/bin/test, so if that would be first in PATH, strace would run run that.



On my Bash, which is also an external command, so it doesn't have an idea about builtins either. On the other hand, the type command is builtin to the shell, and type test would show that test is a shell builtin.






share|improve this answer















test is an unfortunate name to use, it's the standard utility for conditional tests. (It's actually the same command as the [ in if [ ... ], it just looks like a syntactical thing, but is really just a normal command.)



test is also builtin in e.g. Bash, so running just test never looks up your binary from the path.



bash$ help test | head
test: test [expr]
Evaluate conditional expression.

Exits with a status of 0 (true) or 1 (false) depending on
the evaluation of EXPR. Expressions may be unary or binary.
[...]


test with no arguments just returns 1 (false).



Running strace test doesn't involve the shell builtin, since strace doesn't implement any utilities itself. It just uses what it finds in your PATH. Note that you probably have the standard test in /bin/test or /usr/bin/test, so if that would be first in PATH, strace would run run that.



On my Bash, which is also an external command, so it doesn't have an idea about builtins either. On the other hand, the type command is builtin to the shell, and type test would show that test is a shell builtin.







share|improve this answer














share|improve this answer



share|improve this answer








edited 3 hours ago

























answered 3 hours ago









ilkkachuilkkachu

57.9k888163




57.9k888163













  • Have an anecdote from 1985.

    – JdeBP
    3 hours ago



















  • Have an anecdote from 1985.

    – JdeBP
    3 hours ago

















Have an anecdote from 1985.

– JdeBP
3 hours ago





Have an anecdote from 1985.

– JdeBP
3 hours ago










ContronThePanda is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















ContronThePanda is a new contributor. Be nice, and check out our Code of Conduct.













ContronThePanda is a new contributor. Be nice, and check out our Code of Conduct.












ContronThePanda is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498685%2fexecutable-file-is-in-path-but-wont-run%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Сан-Квентин

8-я гвардейская общевойсковая армия

Алькесар