[NTLUG:Discuss] bash Script help

Steve Litt slitt at troubleshooters.com
Wed Aug 28 14:40:37 CDT 2013


On Wed, 28 Aug 2013 14:05:59 -0500
Bobby Wrenn <bobby at wrennest.com> 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&
> ==================

I'm not going to try to reverse engineer your code to hypothesize the
root cause, but I can tell you how to narrow it down. Divide and
Conquer.

I'd start by removing everything but the echo and
the ./FactoryRestore.sh&.

By the way, I've never seen the & at the end of a command without a
space preceding it. Just for fun, put in a space.

Thanks,

SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance



More information about the Discuss mailing list