I checked similar questions and tried the answers given, no luck there.
I'm using WSL and trying to do what ought to be simple. Take a windows path and format it, letting me cd to that directory with this script, let's call it cdw.
The script:
#!/bin/bash
input_path="$1"
# Replace backslashes with forward slashes
new_path="${input_path//\\//}"
# Replace drive letter with linux mount path
new_path="${new_path/Z:/\/mnt\/z}"
echo "$new_path"
cd "$new_path"
However, trying ./cdw.sh 'Z:\test' echoed the expected $new_path but does not cd there:
user1: /mnt/z $ ./cdw.sh 'Z:\test'
/mnt/z/test
user1: /mnt/z $
Is there something really simple I'm missing here?