【发布时间】:2014-09-01 14:52:31
【问题描述】:
#!/bin/ksh
echo -n "enter the 1 to convert lower to upper or 2 convert upper to lower"
read n
echo -in_str "Enter the string here"
read in_str
echo $n
echo $in_str
if [ $n -eq 1 ] then
$ echo $in_str| awk '{print toupper($0)}'
elif [ -n -eq 2 ] then
$ echo $in_str| awk '{print tolower($0)}'
else
echo "please select the correct choice"
fi
出现错误:否则我无法运行上述代码
【问题讨论】:
-
awk 的替代品是
typeset -u in_str和tr '[:upper:]' '[:lower:]'