How do I get the prompt back when running `at' from terminal












1















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?










share|improve this question









New contributor




cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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
















1















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?










share|improve this question









New contributor




cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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














1












1








1


1






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?










share|improve this question









New contributor




cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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






share|improve this question









New contributor




cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 1 hour ago







cdaaawg













New contributor




cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









cdaaawgcdaaawg

62




62




New contributor




cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






cdaaawg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • 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



















  • 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

















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










1 Answer
1






active

oldest

votes


















1














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.






share|improve this answer























    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.










    draft saved

    draft discarded


















    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









    1














    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.






    share|improve this answer




























      1














      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.






      share|improve this answer


























        1












        1








        1







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 1 hour ago









        Jeff SchallerJeff Schaller

        43.1k1159137




        43.1k1159137






















            cdaaawg is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            濃尾地震

            How to rewrite equation of hyperbola in standard form

            No ethernet ip address in my vocore2