通过process.env为整个脚本设置环境变量

时间:2018-11-10 21:09:09

标签: node.js bash

我想做类似cross-env-shell的事情。我有一个(distance, length) + literal之类的npm脚本。在 <?php $sql = "SELECT * FROM inventory LIMIT 10"; $result = mysqli_query($conn, $sql); while ($row = $result->fetch_assoc()) { if ($row['featured']=="true") { echo '<div class="slide">'; echo '<div class="car-block">'; echo '<div class="img-flex">'; echo '<a href="inventory-listing.php?vin='.$row['vin'].'">'; echo '<span class="align-center">'; echo '<i class="fa fa-3x fa-plus-square-o"></i></span></a>'; echo '<img src="images/inventory/'.$row['vin'].'-main.png" alt="" class="img-responsive">'; echo '</div>'; echo '<div class="car-block-bottom">'; echo '<h6><strong>'.$row['year'].' '.$row['make'].' '.$row['model'].'</strong></h6>'; echo '<h6>'.$row['body'].', '.$row['milage'].' miles</h6>'; echo '<h5>$ '.$row['price'].'</h5>'; echo '</div>'; echo '</div>'; echo '</div>'; } else { echo "nothing to be shown"; } } 中,我通过node createAccounts.js & (sleep 5 && npm start)设置了一些环境变量。但是这些环境变量无法通过下一个过程createAccounts.js看到。如何在命令之间保留环境变量?

0 个答案:

没有答案