Run this at a KornShell (ksh):
echo ${MYVAR} | sed 's/\//\\/g'
It works fine if MYVAR is //myserver/myshare
But doing the same and trying to put it into a variable and it fails with
sed: newline or end of file found in pattern
UNCVAR=`echo ${MYVAR} | sed 's/\//\\/g'`
How do I properly convert this path from the UNIX style slashes to the windows style slashes?
Important sample data:
//QFLELSAMPLE/reports
Yet another reason to stop using backticks (unless you plan to be using the Bourne Shell on Solaris/HP/et.al.) Backticks are deprecated according ‘The New Kornshell programming Language’, published in 1995!
Notice that I’m using the
$( cmd )version of command substitution.I hope this helps.