commands.txt
Code:
list
of
commands
enter
separated
script.sh
Code:
#!/bin/bash
commandfile="/path/to/commands.txt"
len=$(cat $commandfile|wc -l)
let rand=$RANDOM%$len
let rand=rand+1
command=$(head -n$rand $commandfile | tail -n1 )
echo $command
results:
Code:
sajko@hanna:~> for i in $(seq 1 20); do sh script.sh; done
command20
command8
command15
command4
command4
command17
command19
command20
command11
command6
command1
command3
command7
command17
command5
command14
command8
command4
command19
command4
Just remove the echo and it'll run the command instead

Best regards
Fredrik Eriksson