2

I run git-bash in windows Portably on a usb drive. Some of the time the drive letter is E and sometimes it is F.

up until recently it had always been F and I'd used aliases such as:

alias subl='"/f/Sublime Text Build 3047/sublime_text.exe"'

in my .bashrc file. Is there a way to find the drive letter and substitute it in so I end up with something like:

alias subl='"/DRIVELETTER/Sublime Text Build 3047/sublime_text.exe"'
user1592380
  • 34,265
  • 92
  • 284
  • 515

1 Answers1

1

As a workaround, don't forget that with Windows, you can assign a permanent driver letter to an USB key (or any drive for that matter).

If not, since there is no /mnt in the Git bash on Windows, you would need to add in your bashrc a loop on the potential drive letter, looking for a known file in your usb key.

for letter in {a..z} ; do
  if [[ -e /${letter}/afile ]]; then
    export DRIVELETTER=${letter}
    break
  fi
done
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250