title: It doesn't work correct after I combine two bash shell files into one
body: <p>When I executing them sequentially, it works. After I combine them, there comes an error.</p>
  
  <p>The first file(a.sh).</p>
  
  <pre><code># !/bin/bash
  
  /etc/init.d/xl2tpd start | xargs echo
  echo "c zju_vpn" &gt; /var/run/xl2tpd/l2tp-control
  </code></pre>
  
  <p>The second file(b.sh).</p>
  
  <pre><code>#!/bin/bash
  
  sleep 3
  
  VPN_SERVER_IP=10.5.1.7
  DEFAULT_GW=10.214.16.1
  route add $VPN_SERVER_IP gw $DEFAULT_GW eth0
  route del default
  route add default ppp0
  ping github.com
  </code></pre>
  
  <p>After <code>echo "c zju_vpn" &gt; /var/run/xl2tpd/l2tp-control</code> has been executed, the ppp0 interface will not appear at once. So I write this <code>sleep 3</code> in file b.sh. </p>
  
  <p>If I combine them into one(c.sh).</p>
  
  <pre><code>#!/bin/bash
  
  /etc/init.d/xl2tpd start
  echo "c zju_vpn" &gt; /var/run/xl2tpd/l2tp-control 
  
  sleep 3
  
  VPN_SERVER_IP=10.5.1.7
  DEFAULT_GW=10.214.16.1
  route add $VPN_SERVER_IP gw $DEFAULT_GW eth0
  route del default
  route add default ppp0
  ping github.com
  </code></pre>
  
  <p><strong>There comes the error: SIOCADDRT: No such device.</strong></p>
  
  <p>There is no ppp0, when I typed <code>ifconfig</code>. So when execute <code>route add default ppp0</code>, it will be failed, and this is the reason. But I DON'T know why this happened.</p>
  
  <p>Somebody helps me. Thanks.</p>