How do I get the prompt back when running `at' from terminal
Perhaps this is more of a general question on scripting and terminal use than of the use of the `at' command. Regardless, I am exploring the use of the at command to get a handle on its behavior and how I can control it before I use it for a serious script.
I wrote a trivial script named at-test.sh, saved it to $HOME and made it executable:
#!/bin/sh
echo $(date +%H:%M:%s) > /dev/pts/9
exit 0
then ran it via
at -f './at-test.sh' now + 1 minutes
It runs as expected, but I must Ctrl+C to get the shell prompt back. I later learned that the Enter key would work also to get the prompt back.
Is there anyway to get the prompt back via a command in the script?
shell-script terminal at
New contributor
add a comment |
Perhaps this is more of a general question on scripting and terminal use than of the use of the `at' command. Regardless, I am exploring the use of the at command to get a handle on its behavior and how I can control it before I use it for a serious script.
I wrote a trivial script named at-test.sh, saved it to $HOME and made it executable:
#!/bin/sh
echo $(date +%H:%M:%s) > /dev/pts/9
exit 0
then ran it via
at -f './at-test.sh' now + 1 minutes
It runs as expected, but I must Ctrl+C to get the shell prompt back. I later learned that the Enter key would work also to get the prompt back.
Is there anyway to get the prompt back via a command in the script?
shell-script terminal at
New contributor
That's odd.at
should immediately go to the background. What version ofat
is this (at -V
)? What operating system? If Enter works, what else do you need?
– terdon♦
1 hour ago
@terdon - at version 3.1.14 running on LinuxMint 17. I just read this [link] (unix.stackexchange.com/a/4230/340857) which is exactly what is happening. I guess it is of no consequence really, I just thought it was odd behavior. My ultimate plan is to use it to end public computer sessions by timing out, then forcing logoff, so that behavior is probably ok.
– cdaaawg
1 hour ago
add a comment |
Perhaps this is more of a general question on scripting and terminal use than of the use of the `at' command. Regardless, I am exploring the use of the at command to get a handle on its behavior and how I can control it before I use it for a serious script.
I wrote a trivial script named at-test.sh, saved it to $HOME and made it executable:
#!/bin/sh
echo $(date +%H:%M:%s) > /dev/pts/9
exit 0
then ran it via
at -f './at-test.sh' now + 1 minutes
It runs as expected, but I must Ctrl+C to get the shell prompt back. I later learned that the Enter key would work also to get the prompt back.
Is there anyway to get the prompt back via a command in the script?
shell-script terminal at
New contributor
Perhaps this is more of a general question on scripting and terminal use than of the use of the `at' command. Regardless, I am exploring the use of the at command to get a handle on its behavior and how I can control it before I use it for a serious script.
I wrote a trivial script named at-test.sh, saved it to $HOME and made it executable:
#!/bin/sh
echo $(date +%H:%M:%s) > /dev/pts/9
exit 0
then ran it via
at -f './at-test.sh' now + 1 minutes
It runs as expected, but I must Ctrl+C to get the shell prompt back. I later learned that the Enter key would work also to get the prompt back.
Is there anyway to get the prompt back via a command in the script?
shell-script terminal at
shell-script terminal at
New contributor
New contributor
edited 1 hour ago
cdaaawg
New contributor
asked 1 hour ago
cdaaawgcdaaawg
62
62
New contributor
New contributor
That's odd.at
should immediately go to the background. What version ofat
is this (at -V
)? What operating system? If Enter works, what else do you need?
– terdon♦
1 hour ago
@terdon - at version 3.1.14 running on LinuxMint 17. I just read this [link] (unix.stackexchange.com/a/4230/340857) which is exactly what is happening. I guess it is of no consequence really, I just thought it was odd behavior. My ultimate plan is to use it to end public computer sessions by timing out, then forcing logoff, so that behavior is probably ok.
– cdaaawg
1 hour ago
add a comment |
That's odd.at
should immediately go to the background. What version ofat
is this (at -V
)? What operating system? If Enter works, what else do you need?
– terdon♦
1 hour ago
@terdon - at version 3.1.14 running on LinuxMint 17. I just read this [link] (unix.stackexchange.com/a/4230/340857) which is exactly what is happening. I guess it is of no consequence really, I just thought it was odd behavior. My ultimate plan is to use it to end public computer sessions by timing out, then forcing logoff, so that behavior is probably ok.
– cdaaawg
1 hour ago
That's odd.
at
should immediately go to the background. What version of at
is this (at -V
)? What operating system? If Enter works, what else do you need?– terdon♦
1 hour ago
That's odd.
at
should immediately go to the background. What version of at
is this (at -V
)? What operating system? If Enter works, what else do you need?– terdon♦
1 hour ago
@terdon - at version 3.1.14 running on LinuxMint 17. I just read this [link] (unix.stackexchange.com/a/4230/340857) which is exactly what is happening. I guess it is of no consequence really, I just thought it was odd behavior. My ultimate plan is to use it to end public computer sessions by timing out, then forcing logoff, so that behavior is probably ok.
– cdaaawg
1 hour ago
@terdon - at version 3.1.14 running on LinuxMint 17. I just read this [link] (unix.stackexchange.com/a/4230/340857) which is exactly what is happening. I guess it is of no consequence really, I just thought it was odd behavior. My ultimate plan is to use it to end public computer sessions by timing out, then forcing logoff, so that behavior is probably ok.
– cdaaawg
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
You've successfully submitted the at
job and it has successfully printed the date to (your) terminal at /dev/pts/9
. You also have a shell there that has printed a prompt and is duly waiting for your input.
This is a simulation of what happened:
your-prompt-here$ at -f './at-test.sh' now + 1 minutes
job 1 at Fri Mar 8 20:13:00 2019
your-prompt-here$
... one minute passes; resume the demonstration
your-prompt-here$ 20:14:1552093897
echo I am still here
I am still here
your-prompt-here$
As you can see, my shell accepted the echo
command; my cursor simply wasn't where I "expected" it to be because the at
job scribbled onto my terminal.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
cdaaawg is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f505245%2fhow-do-i-get-the-prompt-back-when-running-at-from-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You've successfully submitted the at
job and it has successfully printed the date to (your) terminal at /dev/pts/9
. You also have a shell there that has printed a prompt and is duly waiting for your input.
This is a simulation of what happened:
your-prompt-here$ at -f './at-test.sh' now + 1 minutes
job 1 at Fri Mar 8 20:13:00 2019
your-prompt-here$
... one minute passes; resume the demonstration
your-prompt-here$ 20:14:1552093897
echo I am still here
I am still here
your-prompt-here$
As you can see, my shell accepted the echo
command; my cursor simply wasn't where I "expected" it to be because the at
job scribbled onto my terminal.
add a comment |
You've successfully submitted the at
job and it has successfully printed the date to (your) terminal at /dev/pts/9
. You also have a shell there that has printed a prompt and is duly waiting for your input.
This is a simulation of what happened:
your-prompt-here$ at -f './at-test.sh' now + 1 minutes
job 1 at Fri Mar 8 20:13:00 2019
your-prompt-here$
... one minute passes; resume the demonstration
your-prompt-here$ 20:14:1552093897
echo I am still here
I am still here
your-prompt-here$
As you can see, my shell accepted the echo
command; my cursor simply wasn't where I "expected" it to be because the at
job scribbled onto my terminal.
add a comment |
You've successfully submitted the at
job and it has successfully printed the date to (your) terminal at /dev/pts/9
. You also have a shell there that has printed a prompt and is duly waiting for your input.
This is a simulation of what happened:
your-prompt-here$ at -f './at-test.sh' now + 1 minutes
job 1 at Fri Mar 8 20:13:00 2019
your-prompt-here$
... one minute passes; resume the demonstration
your-prompt-here$ 20:14:1552093897
echo I am still here
I am still here
your-prompt-here$
As you can see, my shell accepted the echo
command; my cursor simply wasn't where I "expected" it to be because the at
job scribbled onto my terminal.
You've successfully submitted the at
job and it has successfully printed the date to (your) terminal at /dev/pts/9
. You also have a shell there that has printed a prompt and is duly waiting for your input.
This is a simulation of what happened:
your-prompt-here$ at -f './at-test.sh' now + 1 minutes
job 1 at Fri Mar 8 20:13:00 2019
your-prompt-here$
... one minute passes; resume the demonstration
your-prompt-here$ 20:14:1552093897
echo I am still here
I am still here
your-prompt-here$
As you can see, my shell accepted the echo
command; my cursor simply wasn't where I "expected" it to be because the at
job scribbled onto my terminal.
answered 1 hour ago
Jeff SchallerJeff Schaller
43.1k1159137
43.1k1159137
add a comment |
add a comment |
cdaaawg is a new contributor. Be nice, and check out our Code of Conduct.
cdaaawg is a new contributor. Be nice, and check out our Code of Conduct.
cdaaawg is a new contributor. Be nice, and check out our Code of Conduct.
cdaaawg is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f505245%2fhow-do-i-get-the-prompt-back-when-running-at-from-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
That's odd.
at
should immediately go to the background. What version ofat
is this (at -V
)? What operating system? If Enter works, what else do you need?– terdon♦
1 hour ago
@terdon - at version 3.1.14 running on LinuxMint 17. I just read this [link] (unix.stackexchange.com/a/4230/340857) which is exactly what is happening. I guess it is of no consequence really, I just thought it was odd behavior. My ultimate plan is to use it to end public computer sessions by timing out, then forcing logoff, so that behavior is probably ok.
– cdaaawg
1 hour ago