-
-
Notifications
You must be signed in to change notification settings - Fork 739
Description
Hi,
I started having an issue with the cd command when cursor agent creates shells and tries to cd to a directory. I get this error:
environment: line 5945: _omb_cd_dirstack[0]: unbound variable

My bash syntax experience is minimal so I tried asking LLM agents. After trying different models, finally GPT-5 high reasoning model fixed it for me by modifying the directories.sh file with this command:
perl -0777 -pe 's/\$\{_omb_cd_dirstack\[0\]\}/\$\{_omb_cd_dirstack[0]-\}/g'
This is the description of the fix from GPT-5:
Oh My Bash aliases cd to _omb_directories_cd, which references _omb_cd_dirstack[0] without guarding for nounset, causing the unbound variable error in non-interactive shells.
I looked for issues/PRs related to this ("cd" or "unbound") but could not find any.
I will create a PR for this soon.