没有找到指令

时间:2015-12-18 02:44:55

标签: linux shell

我是shell脚本新手

以下是我的剧本

#!/bin/bash

first_num = 0
second_num = 0

echo -n "Enter the first number =>"
read first_num
echo -n "Enter the second number =>"
read second_num

echo "first + second = $((first_num + second_num))"

每当我运行它时,它会打印如下

/Users/haani/arithmetic.bash: line 3: first_num: command not found 

/Users/haani/arithmetic.bash: line 4: second_num: command not found  

Enter the first number =>

在这里找不到命令的原因是什么?

1 个答案:

答案 0 :(得分:0)

尝试没有空格:

first_num=1