0

If I have a bash script like:

PATH_SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "$PATH_SCRIPT"

If will echo something like:

/c/path/to/where/the/file/is

And generally, that is okay. But in some places, if running on windows, I'll actually need to parse this variable so it looks like this:

C:\path\to\where\the\file\is

How can I do that properly in bash and be able to pass it around?

Mefitico
  • 816
  • 1
  • 12
  • 41
  • Found the answer [here](https://stackoverflow.com/questions/13701218/windows-path-to-posix-path-conversion-in-bash) but I'll leave the question as written, because it may help people who don't know the wording to find the correct question. – Mefitico Jul 27 '22 at 18:27

1 Answers1

0

If you are using Git-Bash, try

cygpath -aw /c/path/to/where/the/file/is
Philippe
  • 20,025
  • 2
  • 23
  • 32