Philipp
Philipp

Reputation: 1298

bash: reading "at" result into variable

I tried all variations and things I found on stackoverflow or Google, but for some reason the at bash command seems to do something different.

What I would like to do is to read the result of my scheduled command into a variable:

myVar=$(echo "echo 'Hello World'" | at now + 1 minute)

The at command prints out things like:

warning: commands will be executed using /bin/sh
job 12 at Wed Mar 13 20:21:00 2024

I would expect to have this information in the ${myVar} with the above, but it's not there. Anyone any idea how I can get the result from at into a variable?

And to be sure it has nothing to do with my bash version:

bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)

Thanks!

Upvotes: 0

Views: 17

Answers (0)

Related Questions