![AIX에서 "at"이 명시적 명령 앞에 "cd /some/path/here"를 추가하게 만드는 이유는 무엇입니까?](https://linux55.com/image/56472/AIX%EC%97%90%EC%84%9C%20%22at%22%EC%9D%B4%20%EB%AA%85%EC%8B%9C%EC%A0%81%20%EB%AA%85%EB%A0%B9%20%EC%95%9E%EC%97%90%20%22cd%20%2Fsome%2Fpath%2Fhere%22%EB%A5%BC%20%EC%B6%94%EA%B0%80%ED%95%98%EA%B2%8C%20%EB%A7%8C%EB%93%9C%EB%8A%94%20%EC%9D%B4%EC%9C%A0%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
다음 명령을 실행할 때:
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
작업 시작 부분, 코드 앞에 명령을 배치하여 이를 수행하는 방법이 있습니다 .
at
at 작업은 명령이 호출되었을 때와 동일한 환경에서 동일한 umask를 사용하여 실행됩니다. AIX는 환경과 umask 저장을 다른 방식으로 구현합니다(방법은 모르겠습니다).