syntax error: unexpected end of file

 

1、脚本只有10行,报第11行错误??

[root@centos79 test]# bash test.sh
test.sh: line 11: syntax error: unexpected end of file
[root@centos79 test]# cat -n test.sh
     1  #!/bin/bash
     2
     3  #step1 check ped file
     4  uniqn=$(sed 's/\r//g' outcome.ped | cut -d " " -f 7- | sed 's/ /\n/g' | sort -u | wc -l)
     5  if [ $uniqn -gt 5 ]
     6  then
     7  echo "error, exception nucleotide: "
     8  sed 's/^M//g' outcome.ped | cut -d " " -f 7- | sed 's/ /\n/g' | sort -u | grep -v [ATGC0];
     9  exit
    10  echo "stage1 ok"

 

 

2、 原来是少了一个fi

 

[root@centos79 test]# cat test.sh
#!/bin/bash

#step1 check ped file
uniqn=$(sed 's/\r//g' outcome.ped | cut -d " " -f 7- | sed 's/ /\n/g' | sort -u | wc -l)
if [ $uniqn -gt 5 ]
then
echo "error, exception nucleotide: "
sed 's/^M//g' outcome.ped | cut -d " " -f 7- | sed 's/ /\n/g' | sort -u | grep -v [ATGC0];
exit
fi
echo "stage1 ok"
[root@centos79 test]# bash test.sh
stage1 ok

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。