Vote count:
0
For a specific reason I have to do an infinite loop inside a function and then run the function as a daemon,
#!/bin/sh
lol(){
while true
do
echo "looping..."
sleep 2
done
}
lol() &
that script doesn't work, it gives me the following error:
/tmp/test: line 9: syntax error: unexpected "&"
How do I do an infinite loop inside a function in ash
?
asked 2 mins ago
1 Answer
Vote count:
0
You're just starting the function wrong -- it's nothing to do with the loop:
lol &
answered 21 secs ago
Ash shell - How to do while loop inside a function?
Aucun commentaire:
Enregistrer un commentaire