#!/bin/bash JOB_ID=$(echo kill $$ | at now + 3min | awk '/^job/ {print $2}') cd /foo/bar/ ./baz atrm $JOB_ID