RE: bash script using dialog



--- Begin Message --- Thomas Beckett wrote:

> I want the script to start the compilation but carry on when it is
> finished whithout the user having to press <Exit>. Do you have any
> suggestions how I can compile the program and inform the user that
> this is happening

Tom, I quikcly wrote the following (very basic) sample script of how
to spawn a background job and then display an interactive progress
bar.

==
#!/bin/sh

# example of displaying a progress bar, waiting for a process to
complete

# create a shell script to run in the background (this one simply
sleeps
# for n seconds and then exits)
BGJOB=/tmp/~$$.sh
echo "#!/bin/sh
sleep 20
exit 0" > $BGJOB


# start background process
sh $BGJOB &

# get the process id of the background process
CPID=`jobs -p`

# monitor process
EC=0
i=0
while ( [ $EC -eq 0 ] )
do
# is the process still running?
# (is there less of a hack to do it than the following?)
EC=`ps -p $CPID 1>/dev/null 2>/dev/null;echo $?`

# we need to feed the process bar with data
let i++
echo $i

done | zenity --title "Waiting on Job" --progress --pulsate
--auto-close


echo "Job is done"

# cleanup
[ -f $BGJOB ] && rm $BGJOB

#eof
==

It should hopefully give you an idea of how to do it on your shell
script.


--
Billy

<<winmail.dat>>


--- End Message ---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This e-mail and its contents are subject to the Telkom SA Limited
e-mail legal notice available at 
http://www.telkom.co.za/TelkomEMailLegalNotice.PDF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


Relevant Pages

  • Re: [PHP] How does the Zend engine behave?
    ... all include files compiled when the script is first compiled, which would mean a cascade through all statically linked include files. ... I.e Are statically included files automatically loaded into memory at the start of a request? ... I assume the eaten memory is for something to do with compilation or caching in the ZE. ... Now suppose a second request arrives for the same script, from a different requester, am I right in assuming that the uncompiled form is loaded? ...
    (php.general)
  • Re: [PHP] How does the Zend engine behave?
    ... all include files compiled when the script is first compiled, which would mean a cascade through all statically linked include files. ... I.e Are statically included files automatically loaded into memory at the start of a request? ... I assume the eaten memory is for something to do with compilation or caching in the ZE. ... Now suppose a second request arrives for the same script, from a different requester, am I right in assuming that the uncompiled form is loaded? ...
    (php.general)
  • Re: Changing a users password non-interactively?
    ... You need expect and a setpass.expect script which ill add ... exit with a nasty warning. ... # Be careful of the COMMAND and UNDOCMD - they are dependant on your ...
    (comp.unix.aix)
  • Re: script does not always work the same each time.
    ... I have written a simple script to test code build and test run on a ... $lineterminationChar {append output $expect_out; ... exit 1;} ...
    (comp.lang.tcl)
  • Re: need small PHP job done
    ... i need help tweaking a PHP mail script; ... // check for a recipient email address and check the validity of it ... // check for an attachment if there is a file upload it ...
    (alt.php)