Results 1 to 6 of 6

Thread: Problem with bash in Suse 11.0

  1. #1

    Default Problem with bash in Suse 11.0

    Hello,
    According to the manuals, the script .bash_logout is supposed to be executed on exit from a login shell. However, try as I would, I could not make this happen. Can anybody give me some advice?
    Regards,
    bostjanv

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Problem with bash in Suse 11.0

    Tried it on a ssh login and it worked fine.

  3. #3
    Join Date
    Jun 2008
    Location
    Germany
    Posts
    301

    Default Re: Problem with bash in Suse 11.0

    As far as I know bash_logout is only executed when bash is used as a login shell and is not executed for example in graphical logins. Maybe you forgot about this.

    Hope this helps

  4. #4
    Join Date
    Jun 2008
    Location
    Boston MA area
    Posts
    61

    Default Re: Problem with bash in Suse 11.0

    Works for me:

    Code:
    $ cat >~/.bash_logout
    echo logging out
    ^D
    $ su -l jdarnold
    Password:
    $ exit
    logout
    logging out
    $

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Problem with bash in Suse 11.0

    To the OP, if what you wanted was to execute something when exiting a shell, login or not, what you want is to set a trap on the pseudo-signal 0, or EXIT. Either of

    trap 'echo arrgh!' 0
    trap 'echo goodbye cruel world' EXIT

    will do what you want. That command can be any valid command or shell script of course.

  6. #6

    Default Re: Problem with bash in Suse 11.0

    Hello,
    Thanks for your posts. In fact, yes, my intention was to perform some action on exit from the graphical shell, and I mistakenly believed that it was somehow identical to a bash login shell. I later checked that a bash login shell behaves correctly (i.e., it executes .bash_logout if it exists), and I solved my problem as suggested in the previous post.
    Regards,
    bostjanv

Posting Permissions

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