由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - 找不到命令的路径
相关主题
问个简单的命令求助:为什么ubuntu下面的gcc不能用呢? (转载)
ubuntu无法上下箭头呼出历史命令问题
新手问个shell的问题问一下在linux下如何写这个命令
Newbie questionbash "." command
setting up bashThe command line is powerful, but the UI can be more efficient!
问一个 remote terminal 的Shell 问题问一个run bash-script command several times的问题
哪位大牛来普及一下 linux 下面的各种环境变量以及设置问问应该学用那个shell?
请教一个sed命令 (转载)zsh的确好用,希望主流distro用这个做default
相关话题的讨论汇总
话题: bashrc话题: script话题: command话题: whereis话题: 命令
进入Linux版参与讨论
1 (共1页)
d*y
发帖数: 7
1
有一条命令(专用的utility),我可以在shell中执行。但如果我在script中去调用它
,系统汇报“command not found”
我用which 和 whereis 都找不到这个命令的路径。
我怎么能在script中用它呢?
谢谢!
l****h
发帖数: 272
2
full path name?

【在 d*y 的大作中提到】
: 有一条命令(专用的utility),我可以在shell中执行。但如果我在script中去调用它
: ,系统汇报“command not found”
: 我用which 和 whereis 都找不到这个命令的路径。
: 我怎么能在script中用它呢?
: 谢谢!

H****n
发帖数: 175
3
source your shell rc file : .bashrc
or
find the path line in your .bashrc
then copy it to your script

【在 d*y 的大作中提到】
: 有一条命令(专用的utility),我可以在shell中执行。但如果我在script中去调用它
: ,系统汇报“command not found”
: 我用which 和 whereis 都找不到这个命令的路径。
: 我怎么能在script中用它呢?
: 谢谢!

v*****r
发帖数: 1119
4
No environment variables should be put in .bashrc file.
LZ could use full path of the command in script, or export PATH in .bash_
profile or .profile

【在 H****n 的大作中提到】
: source your shell rc file : .bashrc
: or
: find the path line in your .bashrc
: then copy it to your script

d*y
发帖数: 7
5
Don't know. It is what I tried to get using which and whereis.

【在 l****h 的大作中提到】
: full path name?
d*y
发帖数: 7
6
source ~/.bashrc can solve this problem. Thanks!
ut why ...
I have found that that command is a function defined in one system .bashrc
file

【在 H****n 的大作中提到】
: source your shell rc file : .bashrc
: or
: find the path line in your .bashrc
: then copy it to your script

v*****r
发帖数: 1119
7
What is the first line in your script?
The shell used to run the script is not bash, otherwise you don't need to
source .bashrc file

【在 d*y 的大作中提到】
: source ~/.bashrc can solve this problem. Thanks!
: ut why ...
: I have found that that command is a function defined in one system .bashrc
: file

d*y
发帖数: 7
8
It was
#!/bin/sh
and I tried to change it to
#!/bin/bash
But it still need to source ~/.bashrc to find that command.

【在 v*****r 的大作中提到】
: What is the first line in your script?
: The shell used to run the script is not bash, otherwise you don't need to
: source .bashrc file

1 (共1页)
进入Linux版参与讨论
相关主题
zsh的确好用,希望主流distro用这个做defaultsetting up bash
bash中比较无聊的功能问一个 remote terminal 的Shell 问题
why terminal is not like an editor?哪位大牛来普及一下 linux 下面的各种环境变量以及设置
如何请教一个sed命令 (转载)
问个简单的命令求助:为什么ubuntu下面的gcc不能用呢? (转载)
ubuntu无法上下箭头呼出历史命令问题
新手问个shell的问题问一下在linux下如何写这个命令
Newbie questionbash "." command
相关话题的讨论汇总
话题: bashrc话题: script话题: command话题: whereis话题: 命令