“Couldn't find a file descriptor referring to the console” on Ubuntu bash on Windows

前端 未结 5 1057
你的背包
你的背包 2020-12-13 05:53

I\'m new in here and it\'s my first post.

I have a problem with Bash on Ubuntu on Windows. If I type \"open (filename)\" on Mac terminal, it opens the file with the

5条回答
  •  半阙折子戏
    2020-12-13 06:08

    On Linux, the open command is an alias for openvt, which runs a command in a new virtual terminal. The virtual terminals are opened by the console. The console only likes to respond to real terminals (not emulated terminals), so the console did not give the emulated terminal it's control FD. Try running your jpg, pdf, ... viewer's command directly in your terminal. (Try sudo openvt -f -s -c 7 -- echo hi in a real Linux CtrlAlt3+ terminal.

    As others have pointed out, on Mac, open does do what you would assume it does. I am not a Mac user, so I can't extend this paragraph.

    However, Windows has it's own version of those commands: start example.txt opens Notepad, start example.docx runs Word, you get the idea. However, Windows is Windows, so start can be as smart as the update writers: start "my file.txt" opens a command prompt window titled my file.txt.

提交回复
热议问题