我正在尝试使用bash制作自动化脚本。但是,我使用的语法显然是错误的,我到处寻找一个好的bash指南但却无法找到。
无论如何,请看下面的代码。我评论了我打算如何使用脚本。
script.sh :
#!/bin/bash
clear
echo "Note: this script will only work if you already ran, [setup.bat] first."
read -p "Did you run [setup.bat] already? <y/n>"
#if $read == y then sh setupKit.sh (run a new shell file)
#if $read == n then setupKit() (Go into a new function)
#Not working the way I want it too.
if [$read == "y"]; then echo "call next script"
if [$read == "n"]; then setupKit()
function setupKit() {
echo "success"
#do something
}