部門 > Bash > 大きい整数でforを使えない?

NQSで何番から何番までのjobを削除するというスクリプトを書くときに、job番号が7桁とかあるんだけど、それをそのままforに入れたら動いてくれなかった。以下のように差をとって回避した。

  1. #!/bin/bash
  2.  
  3. declare -i start
  4. declare -i stop
  5.  
  6. echo "From ? (Enter the Integer)"
  7. read start
  8.  
  9. echo "To ? (Enter the Integer)"
  10. read stop
  11.  
  12. declare -i n
  13. n=$stop-$start
  14.  
  15. declare -i i
  16. declare -i j
  17.  
  18. for i in $(seq 0 $n)
  19. do
  20. j=$start+$i
  21. qdel -k $j
  22. done

forが以下の様な感じで、start,stopが大きいと動かない。
  1. for i in $(seq $start $stop)
  2. do
  3. qdel -k $i
  4. done



参考リンク

タグ:

Bash NQS
最終更新:2012年09月13日 11:07