Reputation: 171
$ echo $billreminder
D:\juno_workspace_x64\9.0.4_app\moneycenter\src\webapp\jsp\billreminder
billreminder="${$billreminder/'D:'/ '\\cygdrive\\d' }"
(this returns BAD SUBSTUTION on cyg-win console windows)
i want to replace 'D:\' with '/cygdrive/d' in above string billreminder
Upvotes: 1
Views: 85
Reputation: 72
You can you string substitution if you prefer, but using cygwin you can also use the command cygpath.
This command convert the parameter supplied as path in Windows-style to path in cygwin-style, you can use it as follow:
b=$(cygpath $b)
Upvotes: 1
Reputation: 7571
you can do it this way:
b='D:\juno_workspace_x64\9.0.4_app\moneycenter\src\webapp\jsp\billreminder'
b=\\cygdrive\\d\\${b#D:\\}
echo $b
Upvotes: 0
Reputation: 70929
Simply remove the second $
sign:
~/> echo ${billreminder/'D:'/ '\\cygdrive\\d'}
\\cygdrive\\d\juno_workspace_x64\9.0.4_app\moneycenter\src\webapp\jsp\billreminder
Upvotes: 1
Reputation: 785196
You can use this substitution:
s='D:\juno_workspace_x64\9.0.4_app\moneycenter\src\webapp\jsp\billreminder'
echo "${s/D:\\//cygdrive/d\\}"
/cygdrive/d\juno_workspace_x64\9.0.4_app\moneycenter\src\webapp\jsp\billreminder
Upvotes: 1