我的一个驱动器上安装了《暗黑破坏神 2》,我想在 Ubuntu 中运行它,但我不想每次都要通过终端来启动它。我试图创建一个 shell 脚本,当我想玩它时,它会自动打开。
这就是我想出的:
#! /bin/bash
wine /media/84964ADD964ACF7C/"Program Files (x86)"/Diablo\ II/Diablo\ II.exe -w
当我运行它时出现/bin/bash^M: bad interpreter: No such file or directory
错误。我做错了什么?
- 我已将权限更改为 755,并且
- 我通过命令行运行它,但它无法运行
哦,我忘了回答,当我在命令行中运行上述命令时,它工作正常,但当我运行脚本时,它不起作用
Problem solved
Apparently when I had accidentally opened up the script in notepad it added some
extra carriage returns, hence the `^M` error. Deleted all the files associated with
the script and redid it in `geany` and it is working just fine now.
答案1
我建议您检查是否已使该文件可执行
右键单击脚本文件并选择属性。接下来单击权限选项卡。