I'm trying to do this as an April Fool's prank: make a linux machine display a message in the shell every few seconds.
My thought is to achieve this by starting an infinite loop that runs as a background job (in .bashrc).
For example, this does what I want:
while true ; do echo Evil Message; sleep 10; done
In order to run it in background I tried:
cmd="while true ; do echo Evil Message; sleep 10;"
$cmd &
but this fails with the error:
while: command not found
Why do I get the error? Is there a way to make this script work?