常用shell:bash、sh、zsh
windows:git bash、cygwin
Mac:Terminal、iTerm
1、在windows下想要执行shell脚本,需要使用到"Git Bash",所以我们需要先安装Git。
2、查看Git环境变量是否配置,没有配置需要配置(我这里安装Git时自动配置了)
3、随意目录,打开"Git Bash"窗口,创建一个shell脚本文件。
打开目录,右击选择“Git Bash Here”,输入:touch test.sh,会创建一个shell脚本文件
4、创建成功后输入内容。
5、运行脚本,有三种运行方式:
(1)./test.sh
(2)sh test.sh
(3)/bin/sh test.sh