Cygwin启动脚本

cod*_*iac 12 bash cygwin startupscript startup

如何在启动后在cygwin中运行脚本?

我想在cygwin启动时自动添加一些挂载并运行其他脚本.我在linux中看到它就像在etc/init.d中添加一个shell文件一样简单.但是,我尝试添加这个dir和chmod + x添加一个shell,chmod那个shell文件,但不起作用.

此外,如果有一种方法可以在关闭时运行脚本,如umount,rmdir等.

小智 17

你在寻找什么

~/.bash_profile
Run Code Online (Sandbox Code Playgroud)

AKA

C:\cygwin\home\CPJ\.bash_profile
Run Code Online (Sandbox Code Playgroud)

使用库存安装,此文件在Cygwin启动时读取.例如,如果要添加更多文件,可以编辑该.bash_profile文件

source foo.sh
source bar.sh
source baz.sh
Run Code Online (Sandbox Code Playgroud)

Bash手册页