shell 调试

test.sh

      1 #! /bin/sh                                                                                                  
      2 A=0
      3 if [ ! -e test.bin ]
      4     then
      5         make
      6         A=1
      7 fi
      8
      9 mipsel-linux-objdump -D -m mips -b binary -EL -M no-aliases -z test.bin >my.dump
     10
     11 if [ $A = 1 ]
     12     then
     13         rm sramboot.o *bin *exe
     14 fi
sh -e 如果一个命令失败就立即退出

sh -n 读入命令但是不执行它们

sh -u 置换时把未设置的变量看作出错

sh -v 当读入shell输入行时把他们显示出来

sh -x执行命令时把命令和它们的参数显示出来

原文地址:https://www.cnblogs.com/openix/p/2526747.html