command not found via shell script but works on terminal
Clash Royale CLAN TAG#URR8PPP
In my .sh file I cannot invoke ant or mv or cp commands but the same commands executes on terminal.below is my script
sample.sh file
#! /bin/sh
cp filename.so filename_org.so
android update project -p .
ant clean
ant release
path added in .bashrc file.
export PATH=$PATH:/usr/bin/
cp, mv , ant are working only under terminal not via scirpt.
shell
add a comment |
In my .sh file I cannot invoke ant or mv or cp commands but the same commands executes on terminal.below is my script
sample.sh file
#! /bin/sh
cp filename.so filename_org.so
android update project -p .
ant clean
ant release
path added in .bashrc file.
export PATH=$PATH:/usr/bin/
cp, mv , ant are working only under terminal not via scirpt.
shell
1
Give us more info about yur problem..
– Ruban Savvy
Oct 20 '14 at 10:47
android
/ant
, are these binaries in /usr/bin?
– UVV
Oct 20 '14 at 11:38
add a comment |
In my .sh file I cannot invoke ant or mv or cp commands but the same commands executes on terminal.below is my script
sample.sh file
#! /bin/sh
cp filename.so filename_org.so
android update project -p .
ant clean
ant release
path added in .bashrc file.
export PATH=$PATH:/usr/bin/
cp, mv , ant are working only under terminal not via scirpt.
shell
In my .sh file I cannot invoke ant or mv or cp commands but the same commands executes on terminal.below is my script
sample.sh file
#! /bin/sh
cp filename.so filename_org.so
android update project -p .
ant clean
ant release
path added in .bashrc file.
export PATH=$PATH:/usr/bin/
cp, mv , ant are working only under terminal not via scirpt.
shell
shell
edited Oct 20 '14 at 11:14
asked Oct 20 '14 at 10:39
user755
148114
148114
1
Give us more info about yur problem..
– Ruban Savvy
Oct 20 '14 at 10:47
android
/ant
, are these binaries in /usr/bin?
– UVV
Oct 20 '14 at 11:38
add a comment |
1
Give us more info about yur problem..
– Ruban Savvy
Oct 20 '14 at 10:47
android
/ant
, are these binaries in /usr/bin?
– UVV
Oct 20 '14 at 11:38
1
1
Give us more info about yur problem..
– Ruban Savvy
Oct 20 '14 at 10:47
Give us more info about yur problem..
– Ruban Savvy
Oct 20 '14 at 10:47
android
/ ant
, are these binaries in /usr/bin?– UVV
Oct 20 '14 at 11:38
android
/ ant
, are these binaries in /usr/bin?– UVV
Oct 20 '14 at 11:38
add a comment |
2 Answers
2
active
oldest
votes
As your script is a shell script (/bin/sh
), then your PATH
entries in .bashrc
will not be read as that is for the bash
(/bin/bash
) interactive shell.
To make your PATH
entries available to /bin/sh
scripts run by a specific user, add the PATH
entry to the .profile
file in that users home directory.
Additionally you could add the full path for each of your commands within the script:
/bin/cp filename.so filename_org.so
Or set the PATH
variable including all the required $PATHS
at the beginning of your script.
PATH=$PATH:/bin:/usr/bin:xxx
export PATH
2
Correct analysis, but you didn't mention the right solution, which is to setPATH
in the proper place instead of.bashrc
. Changing the script to be a bash script will not make any difference:.bashrc
is only loaded by interactive shells.
– Gilles
Oct 21 '14 at 21:34
add a comment |
Had the same issue while running a binary whose path is set in bashrc.
Solved the issue by doing the following:
Add the binary or add a link to the binary in /usr/bin.
ln -s [path_to_binary] [name_of_executable]
Then check using
ls -l
You can remove the entry form bashrc.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f163120%2fcommand-not-found-via-shell-script-but-works-on-terminal%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As your script is a shell script (/bin/sh
), then your PATH
entries in .bashrc
will not be read as that is for the bash
(/bin/bash
) interactive shell.
To make your PATH
entries available to /bin/sh
scripts run by a specific user, add the PATH
entry to the .profile
file in that users home directory.
Additionally you could add the full path for each of your commands within the script:
/bin/cp filename.so filename_org.so
Or set the PATH
variable including all the required $PATHS
at the beginning of your script.
PATH=$PATH:/bin:/usr/bin:xxx
export PATH
2
Correct analysis, but you didn't mention the right solution, which is to setPATH
in the proper place instead of.bashrc
. Changing the script to be a bash script will not make any difference:.bashrc
is only loaded by interactive shells.
– Gilles
Oct 21 '14 at 21:34
add a comment |
As your script is a shell script (/bin/sh
), then your PATH
entries in .bashrc
will not be read as that is for the bash
(/bin/bash
) interactive shell.
To make your PATH
entries available to /bin/sh
scripts run by a specific user, add the PATH
entry to the .profile
file in that users home directory.
Additionally you could add the full path for each of your commands within the script:
/bin/cp filename.so filename_org.so
Or set the PATH
variable including all the required $PATHS
at the beginning of your script.
PATH=$PATH:/bin:/usr/bin:xxx
export PATH
2
Correct analysis, but you didn't mention the right solution, which is to setPATH
in the proper place instead of.bashrc
. Changing the script to be a bash script will not make any difference:.bashrc
is only loaded by interactive shells.
– Gilles
Oct 21 '14 at 21:34
add a comment |
As your script is a shell script (/bin/sh
), then your PATH
entries in .bashrc
will not be read as that is for the bash
(/bin/bash
) interactive shell.
To make your PATH
entries available to /bin/sh
scripts run by a specific user, add the PATH
entry to the .profile
file in that users home directory.
Additionally you could add the full path for each of your commands within the script:
/bin/cp filename.so filename_org.so
Or set the PATH
variable including all the required $PATHS
at the beginning of your script.
PATH=$PATH:/bin:/usr/bin:xxx
export PATH
As your script is a shell script (/bin/sh
), then your PATH
entries in .bashrc
will not be read as that is for the bash
(/bin/bash
) interactive shell.
To make your PATH
entries available to /bin/sh
scripts run by a specific user, add the PATH
entry to the .profile
file in that users home directory.
Additionally you could add the full path for each of your commands within the script:
/bin/cp filename.so filename_org.so
Or set the PATH
variable including all the required $PATHS
at the beginning of your script.
PATH=$PATH:/bin:/usr/bin:xxx
export PATH
edited Oct 21 '14 at 23:00
answered Oct 20 '14 at 11:41
geedoubleya
3,0131118
3,0131118
2
Correct analysis, but you didn't mention the right solution, which is to setPATH
in the proper place instead of.bashrc
. Changing the script to be a bash script will not make any difference:.bashrc
is only loaded by interactive shells.
– Gilles
Oct 21 '14 at 21:34
add a comment |
2
Correct analysis, but you didn't mention the right solution, which is to setPATH
in the proper place instead of.bashrc
. Changing the script to be a bash script will not make any difference:.bashrc
is only loaded by interactive shells.
– Gilles
Oct 21 '14 at 21:34
2
2
Correct analysis, but you didn't mention the right solution, which is to set
PATH
in the proper place instead of .bashrc
. Changing the script to be a bash script will not make any difference: .bashrc
is only loaded by interactive shells.– Gilles
Oct 21 '14 at 21:34
Correct analysis, but you didn't mention the right solution, which is to set
PATH
in the proper place instead of .bashrc
. Changing the script to be a bash script will not make any difference: .bashrc
is only loaded by interactive shells.– Gilles
Oct 21 '14 at 21:34
add a comment |
Had the same issue while running a binary whose path is set in bashrc.
Solved the issue by doing the following:
Add the binary or add a link to the binary in /usr/bin.
ln -s [path_to_binary] [name_of_executable]
Then check using
ls -l
You can remove the entry form bashrc.
add a comment |
Had the same issue while running a binary whose path is set in bashrc.
Solved the issue by doing the following:
Add the binary or add a link to the binary in /usr/bin.
ln -s [path_to_binary] [name_of_executable]
Then check using
ls -l
You can remove the entry form bashrc.
add a comment |
Had the same issue while running a binary whose path is set in bashrc.
Solved the issue by doing the following:
Add the binary or add a link to the binary in /usr/bin.
ln -s [path_to_binary] [name_of_executable]
Then check using
ls -l
You can remove the entry form bashrc.
Had the same issue while running a binary whose path is set in bashrc.
Solved the issue by doing the following:
Add the binary or add a link to the binary in /usr/bin.
ln -s [path_to_binary] [name_of_executable]
Then check using
ls -l
You can remove the entry form bashrc.
answered May 10 '17 at 6:57
Naba
1
1
add a comment |
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f163120%2fcommand-not-found-via-shell-script-but-works-on-terminal%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
Give us more info about yur problem..
– Ruban Savvy
Oct 20 '14 at 10:47
android
/ant
, are these binaries in /usr/bin?– UVV
Oct 20 '14 at 11:38