Skip to content

Fix try interactive selector appearing on bashrc re-source#4877

Merged
dhh merged 1 commit intobasecamp:devfrom
davidguttman:fix-try-init-resource
Mar 4, 2026
Merged

Fix try interactive selector appearing on bashrc re-source#4877
dhh merged 1 commit intobasecamp:devfrom
davidguttman:fix-try-init-resource

Conversation

@davidguttman
Copy link
Contributor

Summary

  • try init defines a shell function named try. On subsequent source ~/.bashrc, the shell function shadows the binary, so try init launches the interactive selector instead of outputting the function definition. Adding command bypasses the function and always invokes the binary.

Details

The one-word change (command try instead of try) is a standard bash pattern — command skips shell functions/aliases and runs the external binary directly. This is the same reason command -v is used in the guard condition above it.

The other eval "$(... init ...)" lines in this file (mise, starship, zoxide) don't have this problem because they don't define a shell function with the same name as the binary.

Test plan

  • Open a fresh terminal — verify try works normally
  • Run source ~/.bashrc — verify no interactive selector popup
  • Run try — verify interactive selector still works as expected

Fixes #4876
Also reported by umaru-sama on Discord (2026-03-01).

🤖 Generated with Claude Code

`try init` defines a shell function named `try`. On subsequent
`source ~/.bashrc`, `try init` calls the function (interactive
selector) instead of the binary. Adding `command` bypasses the
function and always calls the binary.

Fixes basecamp#4876

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 2, 2026 20:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@thegreyfellow
Copy link

if this ain't the cleanest PR I have ever seen 🚀

@dhh dhh merged commit e648902 into basecamp:dev Mar 4, 2026
2 of 4 checks passed
@dhh dhh mentioned this pull request Mar 7, 2026
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.

Re-sourcing .bashrc triggers try interactive selector

4 participants