我想用这个脚本编写foo.sh中的read:
b=1
c=1
y=1
echo "What is the name for the $((b++)) database ?"
read name$((c++))
echo $name$((y++)) >> foo.sh
我希望在foo.sh中代表:
Name1
Name2
Name3
但只有
1
2
3
任何想法?
答案 0 :(得分:1)
您必须将read <var>
放在单独的一行。您也不需要其中一个变量。试试这个 -
b=1
c=1
echo "What is the name for the $((b++)) database ?"
read name
name=$name$((c++))
echo $name >> foo.sh