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

-bash: PROMPT_COMMAND: readonly variable #687

Open
SmallPineApp1e opened this issue Oct 11, 2023 · 1 comment
Open

-bash: PROMPT_COMMAND: readonly variable #687

SmallPineApp1e opened this issue Oct 11, 2023 · 1 comment

Comments

@SmallPineApp1e
Copy link

When I installed autojump by git clone xxx && install.py, I added that code in my ~/.bashrc and source it

[[ -s /home/zengzhijie/.autojump/etc/profile.d/autojump.sh ]] && source /home/zengzhijie/.autojump/etc/profile.d/autojump.sh

but it reminded me "-bash: PROMPT_COMMAND: readonly variable", and autojump didn't work, can someone help me? :(

@justsz
Copy link

justsz commented Apr 24, 2024

See what you get if you do echo $PROMPT_COMMAND. In my case it showed that USER_PROMPT_COMMAND is run at the end of PROMPT_COMMAND.
I then edited ~/.autojump/share/autojump/autojum.bash (change as appropriate if your shell isn't bash) to replace the line

PROMPT_COMMAND="${PROMPT_COMMAND:+$(echo "${PROMPT_COMMAND}" | awk '{gsub(/; *$/,"")}1') ; }autojump_add_to_database"

with

USER_PROMPT_COMMAND="${USER_PROMPT_COMMAND:+$(echo "${USER_PROMPT_COMMAND}" | awk '{gsub(/; *$/,"")}1') ; }autojump_add_to_database"

.
That got autojump working for me.

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