我的Bash脚本文件无法正常工作。为什么?

时间:2016-01-16 02:26:07

标签: bash unix terminal

我正在尝试使用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
}

0 个答案:

没有答案
相关问题