In a terminal, entering cd ./someDir and cd someDir achieves the same result, i.e. a change from the current directory to the someDir sub-directory.
In which situations would you use one over the other, or are the two commands exactly equivalent?
man cd doesn't shed much light on the question and I couldn't easily find documentation online. Are there docs covering this somewhere?
I'm running a standard shell in MacOS Catalina on VSCode, $SHELL --version reports GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
This is my first question and I'm open to any feedback on how to improve it. Thanks.
Edit: This isn't related to a particular use case I've got, I'd just like to know if there's any actual difference between the commands.
It came up in a PR recently where I saw the cd ./ used, I asked whey they'd used that rather than cd by itself. They understood that the former "ensures it's constrained to the current directory" but weren't able to explain further.
On the face of it both commands are the same, but in Bash subtle differences can lead to different behaviour and I'd like to know whether that's the case here. Normally I'd use cd by itself. I understand . is a reference to the current directory.