Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong shell expression output #530

Open
Michaelzhouisnotwhite opened this issue Feb 21, 2024 · 1 comment
Open

Wrong shell expression output #530

Michaelzhouisnotwhite opened this issue Feb 21, 2024 · 1 comment

Comments

@Michaelzhouisnotwhite
Copy link

reproduce

# in origin shell:
echo $(cd "${SCRIPT_DIR}";pwd)

the command shows the script current path. However, in oh-my-bash, it shows the same path twice.

output

oh-my-bash:
image

origin shell:
image

@akinomyoga
Copy link
Contributor

In Oh My Bash, cd is configured to print the new path when it finds the destination directory in the current directory. To turn off this behavior, you can set an empty string to CDPATH:

# bashrc (after source "$OSH"/oh-my-bash.sh)

CDPATH=

Or you can redirect the output of cd in the above case:

echo $(cd "${SCRIPT_DIR}" >/dev/null; pwd)

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

No branches or pull requests

2 participants