Reputation: 11
#!/bin/bash
# Define the infos
Clock() {
DATE=$(date "+%a %b %d, %T")
echo -n " $DATE"
}
Sound() {
Level=$(awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master))
echo -n " $Level"
}
# Print the info
while true
do
echo "\c\f0 $(Clock)\ur"
sleep 1
done &
while true
echo "\r\f0 $(Sound)\ur"
done
I need to run those two loops at the same time. I googled and found that adding that "&" at the end of the first one is supposed to run it on background. However, when I tried it gave the error:
/home/yves/.fluxbox/bar.sh: line 27: syntax error near unexpected token `done'
/home/yves/.fluxbox/bar.sh: line 27: `done'
Any help is appreciated! would this be easy to just do in another language?
Upvotes: 0
Views: 327
Reputation: 183251
The problem is in your second while
-loop: you don't have a do
, so you never close the condition-block and start the body-block.
That is — change this:
while true
echo "\r\f0 $(Sound)\ur"
done
to this:
while true ; do
echo "\r\f0 $(Sound)\ur"
done
Upvotes: 2