我s2cmd
在我的 unix 机器上安装了一个包。当我从它所在的文件夹运行它时,它工作正常,但它无法从其他位置运行,因此我使用命令设置了 PATH,该文件夹中export PATH=$PATH:/opt/bitnami/S3Tools/s3cmd-1.5.0-alpha1
有一个s3cmd
必须执行的文件。
现在的问题是,当我执行 时which s3cmd
,我得到了正确的路径作为输出,但是当我使用 运行它时,sudo s3cmd
它会说command not found
。如果我给出绝对路径并尝试运行它,它会从任何位置运行。
我究竟做错了什么?
编辑 :我刚刚注意到有 2 个 PATH 变量具有相同的路径。这会导致问题吗?如果是,我该如何纠正?
$ set | grep PATH
PATH=/opt/bitnami/rvm/bin:/opt/bitnami/memcached/bin:/opt/bitnami/varnish/bin:/opt/bitnami/redis/bin:/opt/bitnami/nodejs/bin:/opt/bitnami/mercurial/bin:/opt/bitnami/perl/bin:/opt/bitnami/git/bin:/opt/bitnami/nginx/sbin:/opt/bitnami/frameworks/laravel/app/Console:/opt/bitnami/frameworks/cakephp/app/Console:/opt/bitnami/frameworks/codeigniter/bin:/opt/bitnami/frameworks/symfony/bin:/opt/bitnami/frameworks/zendframework/app/Console:/opt/bitnami/sphinx/bin:/opt/bitnami/sqlite/bin:/opt/bitnami/apps/django/bin:/opt/bitnami/php/bin::/opt/bitnami/java/bin:/opt/bitnami/mysql/bin:/opt/bitnami/postgresql/bin:/opt/bitnami/apache2/bin:/opt/bitnami/python/bin:/opt/bitnami/subversion/bin:/opt/bitnami/ruby/bin:/opt/bitnami/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/bitnami/S3Tools/s3cmd-1.5.0-alpha1:/opt/bitnami/S3Tools/s3cmd-1.5.0-alpha1
_=PATH
export PATH;
PATH="$2:$PATH"
PATH="$PATH:$2"
PATH="${rvm_user_path_prefix}:$PATH";
PATH="$(printf "%b" "$PATH" | awk -v RS=: -v ORS=: '!($0 in a){a[$0];print}')";
PATH="${PATH/%:/}";
export PATH;
if printf "%b" "${PATH//:/ }" | GREP_OPTIONS="" \grep -vF "${rvm_bin_path}" > /dev/null 2>&1; then
PATH="$PATH:${rvm_bin_path}"
PATH="${rvm_bin_path}:$PATH"
printf "%b" "export PATH ; PATH=\"${rvm_ruby_gem_home}/bin:${rvm_ruby_global_gems_path}/bin:${rvm_ruby_home}/bin:${rvm_bin_path}:\$PATH\"\n" > "$file_name";
for variable in rvm_env_string rvm_path rvm_ruby_string rvm_gemset_name RUBY_VERSION GEM_HOME GEM_PATH MY_RUBY_HOME IRBRC MAGLEV_HOME RBXOPT;
export PATH;
\awk '/PATH/' < "$actual_file";
rvm_error "Neither md5 nor md5sum were found in the PATH";
rvm_error "Neither md5 nor md5sum were found in the PATH";
export PATH;
PATH=":$PATH:";
PATH="${PATH//:$1:/:}";
PATH="${PATH//::/:}";
PATH="${PATH%:}";
PATH="${PATH#:}"
PATH="$(printf "%b" "$PATH" | awk -v RS=: -v ORS=: "/${rvm_path//\//\/}/ {next} {print}")";
PATH="${PATH/%:/}";
export PATH;
export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC;
rvm_error "Neither sha256sum nor shasum found in the PATH";
rvm_error "Neither sha256sum nor shasum found in the PATH";
export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC;
GEM_PATH="$rvm_ruby_gem_path";
unset BUNDLE_PATH;
GEM_PATH="$GEM_PATH:$MAGLEV_HOME/lib/maglev/gems/1.8/";
new_path="$GEM_HOME/bin:$rvm_ruby_global_gems_path/bin:$MY_RUBY_HOME/bin:${rvm_bin_path}:$(__rvm_remove_rvm_from_path ;printf "%b" "$PATH")";
new_path="$GEM_HOME/bin:$MY_RUBY_HOME/bin:${rvm_bin_path}:$(__rvm_remove_rvm_from_path ;printf "%b" "$PATH")";
export PATH="$new_path";
unset GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION IRBRC;
new_path="$(__rvm_remove_rvm_from_path ; printf "%b" "$PATH"):${rvm_bin_path}";
new_path="$PATH:${rvm_bin_path}";
COMPREPLY=($( eval PATH="$PATH:/sbin" $cmd 2>/dev/null | awk '/^[^ \t]/ { print $1 }' ));
if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
for i in ${CDPATH//:/'
if [ "${INFOPATH: -1:1}" == ':' ]; then
infopath=${INFOPATH}${infopath};
if [ ${INFOPATH:+set} ]; then
infopath=$INFOPATH;
COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" lsmod | awk '{if (NR != 1) print $1}' )" -- "$1" ))
[ -z "$classpath" ] && classpath=$CLASSPATH;
local PATH="$PATH:/sbin:/usr/sbin";
manpath=$MANPATH;
COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ))
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin;
COMPREPLY=("${COMPREPLY[@]}" $( compgen -W "$( PATH="$PATH:/sbin" ifconfig -a | sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' -ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" -- "$cur" ))
COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" sysctl -N -a 2>/dev/null )" -- "$cur" ));
COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ))
GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_gem_home${rvm_gemset_separator:-"@"}global";
export rvm_ruby_gem_home GEM_HOME GEM_PATH;