s2cmd
我在我的 UNIX 機器上安裝了一個軟體包。當我從它所在的資料夾運行它時,它工作正常,但它沒有從其他位置運行,因此我使用命令設定 PATH,該資料夾內export PATH=$PATH:/opt/bitnami/S3Tools/s3cmd-1.5.0-alpha1
有一個s3cmd
必須執行的檔案。
現在的問題是,當我執行 a 時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;