一道shell题报错
题目:输入一个字符串,判断是否是回文代码:
#!/bin/bash
read -p "input:" word
rword='echo $word | rev'
if [ $word = $rword ];
then
echo yes
else
echo no
fi
错误:
input:waaw
7.sh: 第 4 行:[: 参数太多
no
#!/bin/bash
read -p "input:" word
rword=`echo $word | rev` # 这个应该是反引号,ESC下面的那个键
if [ $word = $rword ];
then
echo yes
else
echo no
fi
页:
[1]