Skip to content

Stop shell-init printing its note into every new shell - #3

Merged
padovanl merged 1 commit into
masterfrom
develop
Aug 25, 2026
Merged

padovanl merged 1 commit into
masterfrom
develop

Conversation

@padovanl

Copy link
Copy Markdown
Owner

eval "$(termdock shell-init)" in a startup file printed

Add to your bash startup file:

eval "$(termdock shell-init bash)"

on every shell you opened. The note was on stderr, which the comment above it claimed was enough to keep it out of the way. It is not: command substitution captures stdout and leaves stderr pointed straight at the terminal, so the one place the note was guaranteed to appear was the one place it must not.

Whether stdout is a terminal is what actually separates the two cases, so that is the condition now. Run by hand it still explains itself; run under eval, or redirected to a file, it says nothing. The snippet itself was always fine and went to stdout as it should, so the integration was working the whole time, just noisily.

Not fixed by deleting the note: it earns its place when someone runs the command to see what it does, and a commented-out printf would have left dead code in place of a condition.

While extracting the name resolution to test it, the docs got the missing half of the $SHELL caveat. They said it detects from $SHELL and that you may name a shell explicitly, without saying when you would want to: $SHELL is the login shell, so anyone who logs in with zsh and also uses bash was being told to put a line in ~/.bashrc that would emit zsh.

`eval "$(termdock shell-init)"` in a startup file printed

  # Add to your bash startup file:
  #   eval "$(termdock shell-init bash)"

on every shell you opened. The note was on stderr, which the comment
above it claimed was enough to keep it out of the way. It is not:
command substitution captures stdout and leaves stderr pointed straight
at the terminal, so the one place the note was guaranteed to appear was
the one place it must not.

Whether stdout is a terminal is what actually separates the two cases,
so that is the condition now. Run by hand it still explains itself; run
under eval, or redirected to a file, it says nothing. The snippet itself
was always fine and went to stdout as it should, so the integration was
working the whole time, just noisily.

Not fixed by deleting the note: it earns its place when someone runs the
command to see what it does, and a commented-out printf would have left
dead code in place of a condition.

While extracting the name resolution to test it, the docs got the
missing half of the $SHELL caveat. They said it detects from $SHELL and
that you may name a shell explicitly, without saying when you would want
to: $SHELL is the login shell, so anyone who logs in with zsh and also
uses bash was being told to put a line in ~/.bashrc that would emit zsh.
@padovanl
padovanl merged commit 596f490 into master Aug 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant