Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Bash で乱数を生成しようとしていますが、$RANDOM が常にゼロを返すようです。
次のコードを使用しています
#!/bin/sh #!/bin/bash testing=$((RANDOM)) echo $testing VAR=$((RANDOM%200+100)) echo $VAR
結果 :
0 100
これを修正する方法はありますか?
スクリプトから行を削除#!/bin/shします。ではなく で$RANDOM動作します。bashsh
#!/bin/sh
$RANDOM
bash
sh