Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You just add quotes around $dir. Bash understands the quotes properly/recursively.

    parent_dir = "$(basename "$dir")"


So I finally found the answer. Thanks.


Bear in mind (pointed by the article as well) that variable assignment doesn't allow spaces around the equals sign, and that in this case the outer parentheses are unnecessary anyway.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: