I work in a windows environment but prefer to use bash in cygwin as my shell. To cd to a lengthy path I am given in windows form I type:
cd $(cygpath -u 'Z:\Some\long\windows\path')
..pasting the windows path in from the clipboard. Since I'm lazy I tried to make a shortcut thus:
#!/usr/bin/env bash if [ -z "$1" ]; then exit 0 else TGT=$(cygpath -u $1) cd $TGT fi exit 0
..then realised that the cd takes place in the shell my script runs in rather than the one I called it from so does not have the desired effect. How do I make this work?