Find the answer to your Linux question:
Results 1 to 8 of 8
Hi Friends, this are my two doubts (i) In office i open many terminal windows when i start my day and in each terminal i keep on login as different ...
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    12

    Debugger for shell script, get rid of multiple exit command

    Hi Friends, this are my two doubts

    (i) In office i open many terminal windows when i start my day and in each terminal i keep on login as different users many times in a day to do some task, by the end of the day when i need to exit from all terminals in a safeway instead of directly closing it i need to execute exit command or CTRL+D many times to close a single terminal safely. Can anybody tell me a way to exit from each terminal in single go, is there any command to acheive this ? I wish if we had a command like exitall like in vi we have :qa command to close multiple files opened in single window. I hope friends you have got what i am asking for ?

    (ii) I want a software for debugging shellscripts searched a lot but dint got it.

  2. #2
    Linux Newbie
    Join Date
    Oct 2008
    Posts
    140
    Could you write a little script that opens a terminal for each user, supplying the correct credentials for each and then exits each when you kill the parent? I'm not sure how to login like that, but there must be a way to do it.
    Kurt

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    22
    Quote Originally Posted by kurtdriver View Post
    Could you write a little script that opens a terminal for each user, supplying the correct credentials for each and then exits each when you kill the parent? I'm not sure how to login like that, but there must be a way to do it.
    Kurt
    expect scripting can help here. you can spawn an xterm (or your preferred shell) binary and specify your login credentials and finally use expect command 'interact'. I mean something of this sort:

    spawn ssh admin@$name
    log_user 1
    expect "assword"
    interact
    If iteration over this is not possible then make small scripts for each login and finally create a master bash script to invoke these expect scripts.
    You can also make an 'alias' and every time you start your day all you have to do is trigger your master bash script using this alias'd command.

    Since i do not have any linux machine at my disposal, i am not sure if you have any show stopper problem here, to me it looks straightforward.

    Good Luck!!

  4. #4
    Just Joined!
    Join Date
    Feb 2009
    Posts
    22
    Quote Originally Posted by lucky10101 View Post
    Hi Friends, this are my two doubts

    (i) In office i open many terminal windows when i start my day and in each terminal i keep on login as different users many times in a day to do some task, by the end of the day when i need to exit from all terminals in a safeway instead of directly closing it i need to execute exit command or CTRL+D many times to close a single terminal safely. Can anybody tell me a way to exit from each terminal in single go, is there any command to acheive this ? I wish if we had a command like exitall like in vi we have :qa command to close multiple files opened in single window. I hope friends you have got what i am asking for ?

    (ii) I want a software for debugging shellscripts searched a lot but dint got it.
    what shell script is it. If it is a bash or bourne script, you may use -x option to see the results of expression evaluation. Most os the time it is exteremly useful in debugging scripts.

    you can use it either in the schell script by providing like
    (assuming your bash is placed in you /bin (which is indeed the case))
    (put this line on top of your file)
    #!/bin/bash -x
    Dont forget to remove it after you are done
    OR

    from command line

    like

    /bin/bash -x <path_to_your_script>
    you can also try -v option. Not that much helpful, still you can explore it.

    Lastly, if these are not the solutions for you, good luck with the debugger
    Hope that helps!!!

  5. #5
    Linux Newbie
    Join Date
    Oct 2008
    Posts
    140
    That's the second time today that I've seen the P dropped from password (in the third post). Amusing, though.

  6. #6
    Just Joined!
    Join Date
    Aug 2007
    Posts
    2

    another method to try

    and this works best if you are exiting your complete session is to perform a killall.

    Another approach is to create a shell script that terminates all of your spawned windows. (hmmmm, this sounds like a fun task to resurrect. I had one years ago. ) )

  7. #7
    Just Joined!
    Join Date
    Sep 2005
    Posts
    2
    This may not be directly related to your question, But might help.
    # Terminate the shell if there is no activity for 5 minutes.
    $ export TMOUT=300

  8. #8
    Just Joined!
    Join Date
    Apr 2010
    Posts
    12

    How my terminal looks

    aaaaaa.p aaaaaaa.p conn.evt maxcrdb.p maxdb.evt maxp.evt mmaxdb.evt name.out wc.prf
    linuxx86_64:110$ pwd
    /scratch/lrathod/triage/110/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyy
    linuxx86_64:110$ ls -a
    . .. aaaaaa.p aaaaaaa.p conn.evt maxcrdb.p maxdb.evt maxp.evt mmaxdb.evt name.out wc.prf
    linuxx86_64:110$ pwd
    /scratch/lrathod/triage/110/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyy
    linuxx86_64:110$ rdl 110
    rdl: USRRDL : /view/rdl110_linuxx86_64/vobs_usrrdl
    rdl: RDL : /view/rdl110_linuxx86_64/vobs_prgs
    rdl: RDLSRC : /view/rdl110_linuxx86_64/vobs_prgs/src/
    rdl: RDLTARG : /view/rdl110_linuxx86_64/vobs_prgs/linuxx86_64/

    Inserting /tools/linuxx86_64/java64/jdk1.5.0_11/bin to beginning of path
    rdl: Java support initiated: JDK jdk1.5.0_11

    OpenEdge Release 11.0ALPHA as of Mon Jun 21 19:00:17 EDT 2010

    Release information:
    - GEM: Tammy St. Pierre (e-mail: tammys)
    - BUILD OWNER(S): 110-build (e-mail)
    - Build Platforms: aix64 hpux1164 hpuxia64 linuxx86 linuxx86_64 linuxppc nt nt64 solaris64
    - Release Platforms: aix64 hpux1164 hpuxia64 linuxx86 linuxx86_64 linuxppc nt nt64 solaris64
    - OS Level: 2.6.18
    linuxx86_64:110$ cd /scratch/lrathod/rerun/110/linuxx86/triage
    linuxx86_64:110$ cd ../maxpath.dir/
    linuxx86_64:110$ vi maxpath

    /scratch/lrathod/rerun/110/linuxx86/maxpath.dir

    Press ENTER or type command to continue
    linuxx86_64:110$ exit //MULTIPLE exit command to safely exit from terminal
    linuxx86_64:110$ exit
    linuxx86_64:110$ exit

    devlinux11(lrathod):


    One more exit command then the terminal will be closed in dis way for dis terminal i need to type exit command for 4 times to safely close the terminal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...