I want to ask the user of my bash script to pass a directory path as argument. Which one of the following is a good programming practice?Require that the user enter a trailing / (forward slash)Require that a user doesn't enter a trailing / (forward slash)
Is it good practice to require a trailing forward slash in directory names?
programming practices;user interface;bash
Best practice is to assume neither.If you have access to path builder utilities/classes use those, if not write your code to accept either format and act accordingly.Nothing's more annoying for the user than having to remember whether to add a trailing slash or not.