What is the simplest way to remove a trailing slash from each parameter in the \'$@\' array, so that rsync copies the directories by name?
rsync
rsync -a
In zsh you can use the :a modifier.
:a
export DIRECTORY='/some//path/name//' echo "${DIRECTORY:a}" => /some/path/name
This acts like realpath but doesn't fail with missing files/directories as argument.
realpath