linux shell命令之tee调试

 

没有加tee命令调试前
cat obtainIP.sh
#!/bin/bash

#对localIP的赋值是命令替换操作,命令替换操作中管道操作比较复杂
localIP=`cat /etc/network/interfaces | grep ‘IPADDR‘ | cut -d= -f2`
echo "The local IP is : $localIP"

加上tee调试命令后
#!/bin/bash

#对localIP的赋值是命令替换操作,命令替换操作中管道操作比较复杂
localIP=`cat /etc/network/interfaces | tee debug.txt | grep ‘IPADDR‘ | tee -a debug.txt | cut -d= -f2` | tee -a debug.txt
echo "The local IP is : $localIP"

./obtainIP.sh
The local IP is :

cat debug.txt
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

linux shell命令之tee调试

上一篇:OpenSSH升级


下一篇:linux shell命令之shift