bash script prob: how can i tell the script that a 'dd' has finished?
I want to set up a script that runs my progress bar until my dd (256Meg image) has completed.
i tried something like # copy the image to /dev/hdc1 dd if=./myimage.img of=/dev/hdc1 & # this is supposed to run until most recently invoked process i.e. # the image i am dd'ing has finished (returned false). until %% #this is line 5 see error message below do /root/my/progress/script done when i run the script it clearly starts up the coping (its in the process list) of the image but doesnt enter the loop, anyway this gives me a error message like so: ./testscript: line 5: fg: no job control |
The %% can only be passed to commands which accept a job id. You should probably read the bash man page or the advanced bash scripting guide. They both explain a little more about this.
Here is a simple script which I just wrote which waits for a command to complete and shows it's progress by displaying a period every second. It uses $! which contains the pid of the last process started in the background. And uses the ps command to see if this process is still running. Code:
#!/bin/bash |
thanks very much for that. I had a look at the man page regarding that --no-headers option.
sorry i made a typo in my code. works fine thanks a lot. |
All times are GMT -5. The time now is 06:41 AM. |