I'm trying to run a command multiple times, changing only the value of a variable (text).
Logic would be like:
myvariables='test1, test2, test3'
echo "my variable is $myvariables"
And then it will be "executed" 3 times, changing the value of the variable...
- my variable is test1
- my variable is test2
- my variable is test3
Of course this is just an example, I do not know if it is possible.
my real code looks like:
#!/bin/sh
SERVER='server1'
if ps ax | grep -v grep | grep $SERVER > /dev/null
then
echo "$SERVER is online" | echo "<h1>$SERVER is online</h1>" > $SERVER.html
else
echo "$SERVER is offline" | echo "<h1>$SERVER is offline</h1>" > $SERVER.html
fi