[NTLUG:Discuss] bash Script help

Bobby Wrenn bobby at wrennest.com
Wed Aug 28 16:26:32 CDT 2013


On 08/28/2013 02:05 PM, 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&
> ==================
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
I have tried all the suggestions offered so far (remove the "clear", 
space before the &, full path) nothing makes any difference. And the 
called script "FactoryRestore.sh" is a one liner and works by itself.

I realized that when I execute the final script by itself that I have to 
sudo because of partimage. I think that may be it.

Bobby


Bobby



More information about the Discuss mailing list