问题
I would like to be able to open the sublime text editor from the command line from Bash on Ubuntu on Windows, but each time I attempt to run the command 'subl' I get hit with
-bash: C:/Program Files/Sublime Text 3/sublime_text.exe: No such file or directory
This is definitely the right directory, but I have no clue as to why this isn't working. Any tips?
回答1:
Run notepad as administrator.
Copy & paste this two line of code below:
#!/bin/bash "$(dirname "$0")/subl.exe" "$@"
Save it as subl.txt inside C:\Program Files\Sublime Text 3
Open the folder 'C:\Program Files\Sublime Text 3'
Finally right click and rename this file to subl. That means remove the .txt extension from that file.
Now, you are ready to use subl command on gitbash or wsl linux terminal.
来源:https://stackoverflow.com/questions/48777809/cant-open-sublime-in-bash-on-ubuntu-on-windows