[NTLUG:Discuss] bash Script help
Fred James
fredjame at fredjame.cnc.net
Wed Aug 28 14:49:35 CDT 2013
Bobby Wrenn wrote:
> I am having trouble getting a script to execute a script. When the
> parent script ends it should execute the last line of the script. It
> works all the way to the last echo and then just exits. Any help
> appreciated. I need to ship this system to the South Pacific next week.
>
> Here is the script:
> ====================
> #!/bin/bash
> #clear
> #/usr/local/apps/Wallpaper/set_bg /root/ViewCastWallpaper.bmp
> clear
> COUNT=10
> echo 'Factory Restore will be performed if you no key is pressed in 10
> seconds...'
> while [ $COUNT -gt 0 ]; do
> echo Factory Restore will be performed in $COUNT seconds..
> echo Press any key to abort!
> echo ' '
> read -sn 1 -t 1 Key
>
> echo $Key
>
> #if [ $# -eq 2 ] ; then
> if test -z "$Key"; then
> echo no key pressed
> else
> exit 0
> fi
>
>
> let COUNT=COUNT-1
> #sleep 1s
> clear
> done
>
> #perform the factory restore!
> echo Factory Restore will start now!
>
> ./FactoryRestore.sh&
> ==================
Bobby Wrenn
Script ran OK for me on Mageia3 (I made a FactoryRestore.sh file to test
that call as well) ... but ...
"It works all the way to the last echo and then just exits." ... does
that mean that it echos "Factory Restore will start now" and then
exits? If that is so then the problem would be in the sub-script call.
My suggestion would be to use the full path rather than the relative path.
Hope this helps
Regards
Fred James
More information about the Discuss
mailing list