To remove trailing chars in a path in shell

November 10, 2010 at 05:19:08
Specs: Windows XP
My path could be
mypath=c:\test\. or mypath=c:\test\

final mypath shoud be c:\test
sed should not be used
${mypath%\\.} removed only \. and not \


See More: To remove trailing chars in a path in shell

Report •

#1
November 10, 2010 at 05:25:47
if mypath=c:\test then it should be as it is

Report •

#2
November 10, 2010 at 07:38:36
In the bash shell, this seems to work for me:

mypath=${mypath%\.}
echo $mypath


Report •
Related Solutions


Ask Question