【发布时间】:2019-12-11 23:58:55
【问题描述】:
我设置了一个简单的、已经可以使用的 bash 脚本,用于在 Windows 上的游戏前端 EmulationStation 中使用特定程序启动特定文件。
但前端通过命令提示符路由其操作。而当使用 Command 通过 Bash 运行脚本时,Bash shell 只是打开然后立即关闭。
Here's an image of what shows for the instant before Bash closes.
这仅在首先通过单独的命令提示符时才会发生,例如 Windows 命令提示符或 Git 命令提示符。直接通过 git-bash shell 运行带有适当参数的脚本就可以了。
如果您出于任何原因想查看脚本,请点击此处:
#!/bin/bash
defaultemulaunch="V:/Emulation/.emulationstation/systems/retroarch/retroarch.exe -L "V:/Emulation/.emulationstation/systems/retroarch/cores/bsnes_mercury_accuracy_libretro.dll" \"$1\""
emu1names=(\
"(1999) Fire Emblem - Thracia 776.smc")
emu1launch="V:/Emulation/.emulationstation/systems/retroarch/retroarch.exe -L "V:/Emulation/.emulationstation/systems/retroarch/cores/snes9x_libretro.dll" \"$1\""
gamename=`basename "$1"`
for index in ${!emu1names[*]}
do
game=${emu1names[index]}
if [ "$game" == "$gamename" ]; then
eval "$emu1launch"
fi
done
eval "$defaultemulaunch"
但值得指出的是,在从单独的命令提示符启动进程时尝试运行 any bash 脚本时会发生这种情况。
注意: Git 安装在包含仿真前端 (V:) 的硬盘驱动器上——而不是系统操作系统/启动驱动器 (C:) 的用户目录或程序目录中.我之所以提到这一点,是因为 git-bash 在明显的“登录”步骤中失败,除非直接启动,感觉这可能是默认文件路径问题。
【问题讨论】:
标签: windows bash command-prompt git-bash