How can I auto-close an urxvt terminal after executing an expect script?Executing script with terminal via...

Which models of the Boeing 737 are still in production?

Is a tag line useful on a cover?

What typically incentivizes a professor to change jobs to a lower ranking university?

Can I make popcorn with any corn?

Why are 150k or 200k jobs considered good when there are 300k+ births a month?

Theorems that impeded progress

Why not use SQL instead of GraphQL?

Mage Armor with Defense fighting style (for Adventurers League bladeslinger)

To string or not to string

How can bays and straits be determined in a procedurally generated map?

strToHex ( string to it's hex representation as string)

What is the word for reserving something for yourself before others do?

Is it important to consider tone, melody, and musical form while writing a song?

Mathematical cryptic clues

Why do falling prices hurt debtors?

How could an uplifted falcon's brain work?

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

Fencing style for blades that can attack from a distance

Is this a crack on the carbon frame?

Why Is Death Allowed In the Matrix?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Minkowski space

Modeling an IPv4 Address

Test if tikzmark exists on same page



How can I auto-close an urxvt terminal after executing an expect script?


Executing script with terminal via command optionShortcut to terminal/bash script without 'instant close'Stop terminal auto executing when pasting a commandHiding terminal when executing zenity bash script by double clickHow to do more with an expect script than just a log inGnome-Terminal Auto Closeauto-complete in terminal for git-validation scriptHow to close all open terminal windows except the one running a shell scriptExpect extra characters after close-quoteHow can I only display errors when executing a .sh script?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I've written a script to handle quick copying of passwords to the clipboard:



#!/usr/bin/expect -f

spawn -noecho zsh
expect "$ "
send "pass show -c "
interact
exit


This script is launched like this:



urxvt -e /home/user/pass_script.sh


The script runs well, but after finishing, the spawned urxvt terminal needs to close. It doesn't do so as of now. How can I make sure it does?










share|improve this question


















  • 1





    does it auto close for other commands like urxvt -e sleep 5? if yes, try urxvt -e expect -d /home/user/pass_script.sh and see what's the problem.

    – pynexj
    Nov 27 '18 at 13:51













  • That code is fine. The problem, I'm guessing, is what the pass command does after you hit enter. Does it ever end?

    – glenn jackman
    Nov 27 '18 at 18:14











  • @pynexj: yes, it does close after running urxvt -e sleep 5. running with debug flag doesn't show me what goes wrong; the script will just copy my password to clipboard and return with a new prompt (instead of exiting). @glenn jackman: well, I have to add my desired password ID after the already entered "pass show -c ". After entering my ID, zsh will return with a prompt instead of exiting.

    – Exeleration-G
    Nov 27 '18 at 18:38











  • just replace interact with expect "$ "

    – pynexj
    Nov 28 '18 at 3:36


















0















I've written a script to handle quick copying of passwords to the clipboard:



#!/usr/bin/expect -f

spawn -noecho zsh
expect "$ "
send "pass show -c "
interact
exit


This script is launched like this:



urxvt -e /home/user/pass_script.sh


The script runs well, but after finishing, the spawned urxvt terminal needs to close. It doesn't do so as of now. How can I make sure it does?










share|improve this question


















  • 1





    does it auto close for other commands like urxvt -e sleep 5? if yes, try urxvt -e expect -d /home/user/pass_script.sh and see what's the problem.

    – pynexj
    Nov 27 '18 at 13:51













  • That code is fine. The problem, I'm guessing, is what the pass command does after you hit enter. Does it ever end?

    – glenn jackman
    Nov 27 '18 at 18:14











  • @pynexj: yes, it does close after running urxvt -e sleep 5. running with debug flag doesn't show me what goes wrong; the script will just copy my password to clipboard and return with a new prompt (instead of exiting). @glenn jackman: well, I have to add my desired password ID after the already entered "pass show -c ". After entering my ID, zsh will return with a prompt instead of exiting.

    – Exeleration-G
    Nov 27 '18 at 18:38











  • just replace interact with expect "$ "

    – pynexj
    Nov 28 '18 at 3:36














0












0








0








I've written a script to handle quick copying of passwords to the clipboard:



#!/usr/bin/expect -f

spawn -noecho zsh
expect "$ "
send "pass show -c "
interact
exit


This script is launched like this:



urxvt -e /home/user/pass_script.sh


The script runs well, but after finishing, the spawned urxvt terminal needs to close. It doesn't do so as of now. How can I make sure it does?










share|improve this question














I've written a script to handle quick copying of passwords to the clipboard:



#!/usr/bin/expect -f

spawn -noecho zsh
expect "$ "
send "pass show -c "
interact
exit


This script is launched like this:



urxvt -e /home/user/pass_script.sh


The script runs well, but after finishing, the spawned urxvt terminal needs to close. It doesn't do so as of now. How can I make sure it does?







command-line scripts automation expect rxvt






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 27 '18 at 11:18









Exeleration-GExeleration-G

4,237104688




4,237104688








  • 1





    does it auto close for other commands like urxvt -e sleep 5? if yes, try urxvt -e expect -d /home/user/pass_script.sh and see what's the problem.

    – pynexj
    Nov 27 '18 at 13:51













  • That code is fine. The problem, I'm guessing, is what the pass command does after you hit enter. Does it ever end?

    – glenn jackman
    Nov 27 '18 at 18:14











  • @pynexj: yes, it does close after running urxvt -e sleep 5. running with debug flag doesn't show me what goes wrong; the script will just copy my password to clipboard and return with a new prompt (instead of exiting). @glenn jackman: well, I have to add my desired password ID after the already entered "pass show -c ". After entering my ID, zsh will return with a prompt instead of exiting.

    – Exeleration-G
    Nov 27 '18 at 18:38











  • just replace interact with expect "$ "

    – pynexj
    Nov 28 '18 at 3:36














  • 1





    does it auto close for other commands like urxvt -e sleep 5? if yes, try urxvt -e expect -d /home/user/pass_script.sh and see what's the problem.

    – pynexj
    Nov 27 '18 at 13:51













  • That code is fine. The problem, I'm guessing, is what the pass command does after you hit enter. Does it ever end?

    – glenn jackman
    Nov 27 '18 at 18:14











  • @pynexj: yes, it does close after running urxvt -e sleep 5. running with debug flag doesn't show me what goes wrong; the script will just copy my password to clipboard and return with a new prompt (instead of exiting). @glenn jackman: well, I have to add my desired password ID after the already entered "pass show -c ". After entering my ID, zsh will return with a prompt instead of exiting.

    – Exeleration-G
    Nov 27 '18 at 18:38











  • just replace interact with expect "$ "

    – pynexj
    Nov 28 '18 at 3:36








1




1





does it auto close for other commands like urxvt -e sleep 5? if yes, try urxvt -e expect -d /home/user/pass_script.sh and see what's the problem.

– pynexj
Nov 27 '18 at 13:51







does it auto close for other commands like urxvt -e sleep 5? if yes, try urxvt -e expect -d /home/user/pass_script.sh and see what's the problem.

– pynexj
Nov 27 '18 at 13:51















That code is fine. The problem, I'm guessing, is what the pass command does after you hit enter. Does it ever end?

– glenn jackman
Nov 27 '18 at 18:14





That code is fine. The problem, I'm guessing, is what the pass command does after you hit enter. Does it ever end?

– glenn jackman
Nov 27 '18 at 18:14













@pynexj: yes, it does close after running urxvt -e sleep 5. running with debug flag doesn't show me what goes wrong; the script will just copy my password to clipboard and return with a new prompt (instead of exiting). @glenn jackman: well, I have to add my desired password ID after the already entered "pass show -c ". After entering my ID, zsh will return with a prompt instead of exiting.

– Exeleration-G
Nov 27 '18 at 18:38





@pynexj: yes, it does close after running urxvt -e sleep 5. running with debug flag doesn't show me what goes wrong; the script will just copy my password to clipboard and return with a new prompt (instead of exiting). @glenn jackman: well, I have to add my desired password ID after the already entered "pass show -c ". After entering my ID, zsh will return with a prompt instead of exiting.

– Exeleration-G
Nov 27 '18 at 18:38













just replace interact with expect "$ "

– pynexj
Nov 28 '18 at 3:36





just replace interact with expect "$ "

– pynexj
Nov 28 '18 at 3:36










1 Answer
1






active

oldest

votes


















0














This works:



#!/usr/bin/expect -f
set timeout -1
spawn -noecho bash
expect "$ "
send "pass show -c "
interact -nobuffer r return
expect "Copied"
sleep 0.05





share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1096456%2fhow-can-i-auto-close-an-urxvt-terminal-after-executing-an-expect-script%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









    0














    This works:



    #!/usr/bin/expect -f
    set timeout -1
    spawn -noecho bash
    expect "$ "
    send "pass show -c "
    interact -nobuffer r return
    expect "Copied"
    sleep 0.05





    share|improve this answer




























      0














      This works:



      #!/usr/bin/expect -f
      set timeout -1
      spawn -noecho bash
      expect "$ "
      send "pass show -c "
      interact -nobuffer r return
      expect "Copied"
      sleep 0.05





      share|improve this answer


























        0












        0








        0







        This works:



        #!/usr/bin/expect -f
        set timeout -1
        spawn -noecho bash
        expect "$ "
        send "pass show -c "
        interact -nobuffer r return
        expect "Copied"
        sleep 0.05





        share|improve this answer













        This works:



        #!/usr/bin/expect -f
        set timeout -1
        spawn -noecho bash
        expect "$ "
        send "pass show -c "
        interact -nobuffer r return
        expect "Copied"
        sleep 0.05






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 13 mins ago









        Exeleration-GExeleration-G

        4,237104688




        4,237104688






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f1096456%2fhow-can-i-auto-close-an-urxvt-terminal-after-executing-an-expect-script%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

            Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

            Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

            Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...