Can't open sublime in Bash on Ubuntu on WIndows

橙三吉。 提交于 2020-07-16 06:16:24

问题


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:


  1. Run notepad as administrator.

  2. Copy & paste this two line of code below:

     #!/bin/bash 
     "$(dirname "$0")/subl.exe" "$@"
    
  3. Save it as subl.txt inside C:\Program Files\Sublime Text 3

  4. Open the folder 'C:\Program Files\Sublime Text 3'

  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!