If symbolic link bar points to folder foo, then the two following commands have very different behaviors:
mv bar baz # rename link 'bar' to 'baz'
mv bar/ baz # rename folder 'foo' to 'baz'
(tried with bash 3.2 and zsh 5.7.1 on OSX).
I find the second behavior very dangerous (especially given that "tab" usually completes folder names with a trailing slash), and would like to prevent it if possible. The manual of mv doesn't seem to have an option for that. Short of aliasing mv with my own function, is there maybe a Bash option or zsh option, or something else, that would help with this issue?
mv bar/ baz -> mv: cannot move 'bar/' to 'baz': Not a directorygmv(installed viabrew install coreutils) has the same issue on my side.set mark-directories offin aINPUTRCfile, but that setting applies to all directories, not just symlinksmark-symlinked-directoriesoption (look inman bash, "Readline Variables" section).renamesystem call, and this looks like a bug in Linux'srename. Why wouldrename("bar/", "baz")fail with ENOTDIR? It's supposed to be equivalent torename("foo", "baz").