简体   繁体   中英

Bash within a bash not working

I used this:

https://thepcspy.com/read/building-a-kiosk-computer-ubuntu-1404-chrome/

to create a nice and simple kiosk compute. One issue I had was the need to login to the kiosk page and I chose to overcome this with xdotool. I created a simple script:

#!/bin/bash
export DISPLAY=:0
sleep 3
xdotool type 'username'
sleep 3
xdotool key Tab
sleep 3
xdotool type 'password'
sleep 3
xdotool key Return
sleep 3
xdotool key Tab
sleep 3
xdotool key Return

and when launched from the command line it works great, however when I add that same code to the script that launches chrome on startup:

#!/bin/bash
xset -dpms
xset s off
openbox-session &
start-pulseaudio-x11

google-chrome --test-type --kiosk  --no-first-run  --ignore-certificate-errors 'url'

sleep 30
export DISPLAY=:0
sleep 3
xdotool type 'username'
sleep 3
xdotool key Tab
sleep 3
xdotool type 'password'
sleep 3
xdotool key Return
sleep 3
xdotool key Tab
sleep 3
xdotool key Return

it fails. I also tried to just execute the working command:

#!/bin/bash
xset -dpms
xset s off
openbox-session &
start-pulseaudio-x11


google-chrome --test-type --kiosk  --no-first-run  --ignore-certificate-errors 'url'

./login.sh

that fails too. Any help is greatly appreciated.

PS I am a web guy with very little linux knowledge so this could be something very stupid but Im learning...

I just had to add & after the google-chrome and specify entire address....so:

google-chrome --test-type --kiosk  --no-first-run  --ignore-certificate-errors 'url'&
/opt/login.sh

Thanks for the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM