I need to use gitbash on MS-Windows with file folder names that contain an exclamation point as the first characters, like "!0-MyProjectFolder" (without the quotation marks. I use the exclamation point to sort Microsoft Windows files to the top, since Windows does not provide a way to index and force sort order of files and folders.
Gitbash keeps giving me error messages:
I've tried several syntaxes already:
$ cd "!0-Projects-WIP"
bash: !0: event not found
$ cd "\!0-Projects-WIP"
bash: \!0: event not found
$ cd !0-Projects-WIP
bash: !0: event not found
Be clear that I am NOT parsing a string like '/New.*desktop.*is/!d' in the StackOverflow posting at How to address error "bash: !d': event not found" in Bash command substitution
VNCServerAndDisplayNumber="$(echo "${VNCServerResponse}" \
| sed '/New.*desktop.*is/!d' | awk -F" desktop is " '{print $2}')"
I am passing the directory name !0-Projects-WIP to GitBash, so that I can change into the directory named !0-Projects-WIP. I am not intending to do double-quoting or history expansion. If the exclamation point in the folder name appears to be a history expansion directive, then that is not the intended result. The ! must be escaped in my case so that it is read correctly as part of the folder name, and the shell command "cd" interprets it as a string.
I realize now that !0-Projects-WIP is probably a bad name to a Unix shell parser because it directs the command line parser to do something that was not my intention, but for the MS-Windows command line shell there is no confusion.