Member-only story
Why we do this ?
Because the volume parameter of docker-compose only accepts WSL format
How do this ?
The test command realized by the sed
command is as follows.
$ echo "c:/Project/test" \
| sed -E 's/^(\w+)+/\L\1/g' \
| sed -e 's/\\/\//g' \
| sed -e 's/://g' \
| sed -e '/^\//!s/^/\//g'
/c/Temp/test
Explanation:
sed -E ‘s/^(\w+)+/\L\1/g’
→ Lowercase initial letterssed -e ‘s/\\/\//g’
→ Convert [] to [/]sed -e ‘s/://
’ → Remove [:]sed -e ‘/^\//!s/^/\//g’
→ If it does not start with [/], add [/] at the beginning
How use this ?
If we run this the output should be like below:
$ sh wsl.sh
/c/Temp/test