2

When I execute the following command:

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

I get the following output:

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

What is causing the cd /some/path/here command to appear? Other users on the same system are not seeing this behavior.

I'm using KornShell in AIX 6.1.

My .envfile contains:

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
5
  • put a pwd at the top of the script, now are the outputs equal... does pwd also equal some path here?
    – eyoung100
    Sep 26, 2014 at 19:56
  • yes, it appears the pwd is getting inserted at the start of the at'd commands Sep 26, 2014 at 19:57
  • is it a script or just the at command?
    – eyoung100
    Sep 26, 2014 at 19:59
  • this behavior occurs when I type the at command at the prompt. It is not embedded in a script. Other users are not seeing this behavior. I've added the contents of the .envfile Sep 26, 2014 at 20:01
  • Hmm, as a bit of debugging, clear out you environment file and reload your shell. If the cd still appears, its not coming from the file.
    – eyoung100
    Sep 26, 2014 at 20:18

1 Answer 1

2

An at job is executed in the directory where the at command was called.

Different implementations achieve that in different ways. It happens that yours does it by putting a cd command at the start of the job, before your code.

An at job is also executed in the same environment as when the at command was called, and with the same umask. AIX implements environment and umask preservation in some other way (I don't know how).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.