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"

syntax error: unexpected end of file

 

 

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

syntax error: unexpected end of file

 

上一篇:Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>)


下一篇:在Mac电脑上安装svn失败解决方案