aix add tag
Max (imported from SE)
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

Top Answer
Gilles (imported from SE)
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).

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.