jan
jan

Reputation: 806

shell script: replace colon in file path

i'm using cygwin to run a few shell scripts under windows. I have this variable containing a Windows file path:

#!/bin/sh
pathToConfig=C:/workspace/proj1/etc/config.properties

Now i need to replace the : in that path by \\: to fit the path in there:

echo "create-jvm-options ${AUTH} \"-Dproperty.location=C\\:/workspace/proj1/etc/config.properties\"" >> ${commandFile}

Any idea how to solve this?

Upvotes: 1

Views: 738

Answers (1)

sat
sat

Reputation: 14959

Try this bash,

echo ${pathToConfig//:/\\\\:}

Upvotes: 2

Related Questions