Today when writing my shell script.
A question suddenly comes to my mind.
Since cd /target_dir
and cd /target_dir/
both works.
Should I add a slash at the end of my path variables in a shell script?
Such as LOG_PATH=/data/nginx/logs
versus LOG_PATH=/data/nginx/logs/
.
I did some gross search on google, but didn't find discussion about this, maybe it's too basic?
For now, it's really hard for me to decide which style to pick.
But I preferred LOG_PATH=/target_dir/
style a bit more.
Because when I'm doing autocompletion with bash, it pops me the result with slash.
What's your opinion about this, why?