Strange output from terminal `exit` command is this a virus?

18

6

I don't think that I have seen this before, but whenever I run exit in terminal I get a very strange output.

This is what it looks like:

logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

And when I remove ~/.bash_sessions I get this output.

logout
Saving session...-bash: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.session: No such file or directory
touch: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: No such file or directory
-bash: history: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: cannot create: No such file or directory

...copying shared history...cp: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.history: No such file or directory

...saving history...cat: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: No such file or directory
-bash: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.history: No such file or directory
-bash: ~/.bash_sessions/EBDD3E18-8D29-42DA-B32C-DD4491951FC0.historynew: No such file or directory
truncating history files...
...completed.
shlock: open(~/.bash_sessions/shlock6026): No such file or directory

[Process completed]

The other thing is it recreates the .bash_sessions folder if it got removed.

Is this some kind of virus or just that I haven't paid that much attention to it, or is this something that Apple added in El Capitan (I'm running OS X 10.11 Build 15A262E) or what else could it be?

Also when I run login <myusername> then I run exit I do not get this odd output. It only seems to be when closing out of terminal.

Note: I have replaced /Users/myusername with ~/ instead. I have also removed my .bash_profile to make sure it wasn't that.

iProgram

Posted 2015-09-20T17:38:16.627

Reputation: 505

Answers

25

This seems to be a change to Bash Session in OS X El Capitan. See Bash sessions

Also see this question in SE.

NZD

Posted 2015-09-20T17:38:16.627

Reputation: 2 142

1Ah, Thanks for that! Glad to know it is an OS based thing! – iProgram – 2015-09-20T20:26:42.357

10Please include all relevant details from pages you’re referring to. They might go away, making your answer incomplete. – Daniel B – 2015-09-20T20:36:10.633

2

had the same problem. Under terminal preferences->profiles -> shell. Select appropriate action to perform under "when the shell exits" menu. Fixed my issue.

Richard Uba

Posted 2015-09-20T17:38:16.627

Reputation: 21

1To just ignore the message and just exit the Terminal, under "When the steel exits:" select "Close if the shell exited cleanly". – sharshi – 2018-02-23T18:27:09.447

0

The last line of /etc/bashrc on the mac reads:

[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"

So to disable all the craziness in the Apple Terminal on exit:

sudo mv /etc/bashrc_Apple_Terminal /etc/bashrc_Apple_Terminal-disabled

Brad Allison

Posted 2015-09-20T17:38:16.627

Reputation: 11

-1

You can add an alias to your shell-profile (like .bashrc) such as:

alias off='exit 0 >/dev/null'

When you use 'off', it exits with those extra messages discarded.

All you get is the 'logout' line, sent to 2>/dev.tty

Dick.Guertin

Posted 2015-09-20T17:38:16.627

Reputation: 42