2 added 546 characters in body
source | link

You can use this one liner to do what you're asking:

$ cmd="..some command..."; for i in $(seq 5); do $cmd; sleep 1; done

Example

$ date
Fri Nov 22 01:37:43 EST 2013

$ cmd="echo"; for i in $(seq 5); do $cmd "count: $i"; sleep 1;done
count: 1
count: 2
count: 3
count: 4
count: 5

$ date
Fri Nov 22 01:37:51 EST 2013

You can adjust the sleep ... to what ever delay you'd like between commands, and change cmd=... to whatever command you want.

Brace expansions vs. seq cmd

You can also use brace expansions instead of the seq command to generate ranges of values. This is a bit more performant since the brace expansions will run in the same shell as the for loop. Using the subshell ($(seq ..)) is a little less performant, since it's spawning a subshell within the confines of the shell that the for loop is running.

Example

$ cmd="echo"; for i in {1..5}; do $cmd "count: $i"; sleep 1;done
count: 1
count: 2
count: 3
count: 4
count: 5

You can use this one liner to do what you're asking:

$ cmd="..some command..."; for i in $(seq 5); do $cmd; sleep 1; done

Example

$ date
Fri Nov 22 01:37:43 EST 2013

$ cmd="echo"; for i in $(seq 5); do $cmd "count: $i"; sleep 1;done
count: 1
count: 2
count: 3
count: 4
count: 5

$ date
Fri Nov 22 01:37:51 EST 2013

You can adjust the sleep ... to what ever delay you'd like between commands, and change cmd=... to whatever command you want.

You can use this one liner to do what you're asking:

$ cmd="..some command..."; for i in $(seq 5); do $cmd; sleep 1; done

Example

$ date
Fri Nov 22 01:37:43 EST 2013

$ cmd="echo"; for i in $(seq 5); do $cmd "count: $i"; sleep 1;done
count: 1
count: 2
count: 3
count: 4
count: 5

$ date
Fri Nov 22 01:37:51 EST 2013

You can adjust the sleep ... to what ever delay you'd like between commands, and change cmd=... to whatever command you want.

Brace expansions vs. seq cmd

You can also use brace expansions instead of the seq command to generate ranges of values. This is a bit more performant since the brace expansions will run in the same shell as the for loop. Using the subshell ($(seq ..)) is a little less performant, since it's spawning a subshell within the confines of the shell that the for loop is running.

Example

$ cmd="echo"; for i in {1..5}; do $cmd "count: $i"; sleep 1;done
count: 1
count: 2
count: 3
count: 4
count: 5
1
source | link

You can use this one liner to do what you're asking:

$ cmd="..some command..."; for i in $(seq 5); do $cmd; sleep 1; done

Example

$ date
Fri Nov 22 01:37:43 EST 2013

$ cmd="echo"; for i in $(seq 5); do $cmd "count: $i"; sleep 1;done
count: 1
count: 2
count: 3
count: 4
count: 5

$ date
Fri Nov 22 01:37:51 EST 2013

You can adjust the sleep ... to what ever delay you'd like between commands, and change cmd=... to whatever command you want.