Skip to content

cd not working in shells created by cursor #716

Description

@gurelkaynak

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

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions