We sometime may require to remove a trailing slash entered by a user as part of some file path in linux systems. The trailing slash can be removed using pattern matching
ex :
$ MYPATH=/home/user1/desktop/
$ echo ${MYPATH%/}
The output will be like : /home/user1/desktop
Comments
Post a Comment