关于bash循环的this基本教程,我编写了以下脚本:
#!/bin/bash
# since Bash v4
i=16
max=256
while [ $i -le $max ]; do
echo $i
let i=i*2
done
但是既然我觉得这很可怕(我是一个纯粹的while
仇恨者),有没有办法写出类似的东西:
#!/bin/bash
# since Bash v4
start = 16
max = 256
for i in {start..max..i*2}
do
echo $i
done
答案 0 :(得分:5)
您可以使用<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="form_vender">
<h1> Vender</h1>
<select id="seleciona_Produto">
<option value="Uno">Uno</option>
<option value="Duo">Duo</option>
<option value="Trilogia">Trilogia</option>
<option value="Cerveja">Cerveja</option>
<option value="Refrigerante">Refrigerante</option>
<option value="Fritas">Fritas</option>
<option value="Água">Água</option>
</select>
<input type="text" size="3" placeholder="Qtde" id="quantidadeVenda">
<br />
<br />
</form>
<input type="submit" onclick="addItem()" value="Adicionar item">
<input type="submit" onclick="FinalizaVenda()" value="Finalizar Venda">
<br />
<br />
<br />
<div id="tabelavenda" class="tabela">
<table>
<thead>
<tr>
<th>Identificação</th>
<th>Porte</th>
</tr>
</thead>
</table>
</div>
循环:
for
给出这个输出:
for ((i = 16; i <= 256; i = i * 2)); do
echo "$i"
done