#!/bin/bash
usagearg() {
echo "You're missing an argument on the command line!" >&2}
usagemiss() {
echo "A file requested in your filestem is missing or cannot be read!" >&2}
if [ ${#} -ne 2 ]; then
usagearg;
exit 1;
fi
x=1
endp=`wc -l ${1}`
end=$((endp+1))
while [ ${x} -ne ${end} ] ; do
# redacted code which isn't related to the issue at hand.
done
我觉得我已经关闭了所有循环和 if 以及所有括号,所以我不明白为什么会出现语法错误。
复合命令大括号内的命令列表必须以分号或换行符终止;右大括号本身是不够的。
要么使用
usagearg() {
echo "You're missing an argument on the command line!" >&2; }
or
usagearg() {
echo "You're missing an argument on the command line!" >&2
}