linux - Ash shell - How to do while loop inside a function? -


for specific reason have infinite loop inside function , run function daemon,

#!/bin/sh lol(){ while true     echo "looping..."     sleep 2 done } lol() & 

that script doesn't work, gives me following error:

/tmp/test: line 9: syntax error: unexpected "&" 

how do infinite loop inside function in ash ?

you're starting function wrong -- it's nothing loop:

lol & 

parenthesis used @ function definition time, not invocation.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -