Skip to content

bash_enter run twice on smartcd load if $PWD ends in a slash #68

@von

Description

@von

If $PWD ends in a slash, I'm seeing bash_enter run twice, the second time with two slashes between the directory path and bash_enter. E.g. the following is from a new shell starting in a tmux pane with the initial path being /Users/von/.local/share/chezmoi/:

DEBUG: PWD=/Users/von/.local/share/chezmoi/
DEBUG: source smartcd
smartcd: running /Users/von/.smartcd/scripts/Users/von/.local/share/chezmoi/bash_enter
Setting up chezmoi environment.
smartcd: running /Users/von/.smartcd/scripts/Users/von/.local/share/chezmoi//bash_enter
Setting up chezmoi environment.
DEBUG: source smartcd done

If I trim the slash from the end of $PWD (PWD=${PWD%/}), the double execution goes away:

DEBUG: PWD=/Users/von/.local/share/chezmoi
DEBUG: source smartcd
smartcd: running /Users/von/.smartcd/scripts/Users/von/.local/share/chezmoi/bash_enter
Setting up chezmoi environment.
DEBUG: source smartcd done

Not sure what version of smartcd I'm running as I can't find any sort of version command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions