I am writing a Bash script accepting input of a path from the user. I want to make the path have no trailing '/', such as '/path/to/dir' instead of '/path/to/dir/'.
However, as the input is from the user, the input could be '/path/to/dir'. My script is intended to handle this.
The question is: how to remove the trailing '/' if the input indeed has it? When the input has not trailing '/', it should be fine.