AIXでは、「at」が明示的なコマンドの前に「cd /some/path/here」を追加するのはなぜですか?

AIXでは、「at」が明示的なコマンドの前に「cd /some/path/here」を追加するのはなぜですか?

次のコマンドを実行するとき:

cd /some/path/here
at -t 201409301100
ls -al
<CTRL-D>
at -lov

次の結果が表示されます。

========================
myusername.1411755840.a   Mon Sep 30 11:00:00 CDT 2014
========================
cd /some/path/here
ls -al

cd /some/path/hereコマンドが表示される原因は何ですか?この動作は、同じシステムの他のユーザーには表示されません。

私はAIX 6.1でKornShellを使用しています。

私の.envfile内容は次のとおりです。

if [ -t 0 ]; then
        case `who am i | awk '{print $1}'` in
                'myusername')
                        #set the prompt to include the date and time
                        #set -o allexport
                        unset _Y _M _D _h _m _s
                        eval $(date "+_Y=%Y;_M=%m;_D=%d;_h=%H;_m=%M;_s=%S")
                        ((SECONDS = 3600*${_h#0}+60*${_m#0}+${_s#0}))
                        typeset -Z2 _h _m _s
                        _tsub="(_m=(SECONDS/60%60)) == (_h=(SECONDS/3600%24)) + (_s=(SECONDS%60))"
                        #_timehm='${_x[_tsub]}$_h:${_m}'
                        #_timehms='${_x[_tsub]}$_h:$_m:${_s}'
                        _timedhms=$_Y'/'$_M'/'$_D" "'${_x[_tsub]}$_h:$_m:${_s}'
                        _hn=`hostname`
                        typeset -u _hn
                        _un=`whoami | awk '{print $1}'`
                        typeset -u _un
                        export PS1="$_timedhms
"'['$_un']'$_hn':${PWD#$HOME/} $ '
                        #set +o allexport
                ;;
                *)
                ;;
        esac
fi

ベストアンサー1

at ジョブは、atコマンドが呼び出されたディレクトリで実行されます。

さまざまな実装では、これをさまざまな方法で実装します。cd作業の開始時に、コードの前にコマンドを配置してこれを行う方法があります。

atat ジョブは、コマンドが呼び出されたときと同じ環境で同じ umask を使用して実行されます。 AIXは、環境とumaskの保管を異なる方法で実装します(方法はわかりません)。

おすすめ記事