The script run_tasks.bash read the text file
The script need to read line by line the text file and execute the scripts in the text file
One important remark about file.txt
Lines numbers in the txt file could be different
For example on the first running lines in txt file could be 12
On the second running lines in txt file could be for example 213 , and so on .....
./run_tasks.bash /tmp/file.txt
Example of text file - file.txt
1 /tmp/run.sh
2 /var/tmp/load_run.pl
3 /etc/RT/LM.pl
.
.
What I want to do is a process dialog progress that illustrate the number of the tasks in the txt file
For example if number of tasks ( lines ) in the txt file is 34 Then the dialog process will start from 0% to 100% according to the 34 tasks
Or
If the number of tasks (lines) in the txt are 321 then the dialog process will start from 0% to 100% reference to the 321 tasks
Another thing the dialog need to view each of the ruining script in the dialog
Please advice how to build the dialog code according to my requirements
Mean while I have the following dialog code but I not understand how to fit this code to the different tasks ( lines ) in the txt file
#!/bin/sh
#A gauge Box example with dialog
(
c=10
while [ $c -ne 110 ]
do
echo $c
echo "###"
echo "$c %"
echo "###"
((c+=10))
sleep 1
done
) |
dialog --title "A Test Gauge With dialog" --gauge "Please wait ...." 10 60 0
It's a matter of math ;) In
items
I've put the total number of items you'll be processing. You probably want to have something likeitems=$(wc -l file.txt)
there. To convert the number of processed lines into a percentage, I do$(( $processed * 100 / $items))
. Note the order, since we only have integers the usual processed/items*100 won't work.