Views:
483
Votes: 3
✅ Solution
Tags:
bashrc
windows-subsystem-for-linux
Link:
🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
URL:
https://askubuntu.com/q/1162728
Title:
WSL: Is there a conditional to detect "Open Linux Shell Here" case?
ID:
/2019/08/01/WSL_-Is-there-a-conditional-to-detect-_Open-Linux-Shell-Here_-case_
Created:
August 1, 2019
Edited: August 2, 2019
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
I would change the ~/.bashrc
enhancement to something like this:
CurrDir="$(pwd)"
if [[ "$CurrDir" == "$SystemDir" ]]
then
cd /path/to/sensible-dir-name
Fi
Where $SystemDir
is your System32 directory. Always remember how \
and /
differ between Windows and Linux paths:
Suggests using:
sed -e 's#^J:##' -e 's#\\#/#g'
That said in your instance you could probably hard-code the path.