linux - select one of outcomes randomally in sh -


i trying randomly choose 1 of 2 outcomes in sh

#!/bin/sh if [$[ $random % 2] -eq 1 ] echo yes else echo no fi 

gives

sh-3.2$ sh test.sh test.bash: line 4: [1: command not found no 

obviously, it's trying execute (0,1) command. doing wrong?

just put space after first [, like

#!/bin/sh if [ $[ $random % 2] -eq 1 ] echo yes else echo no fi 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -