LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   using parameters from one bash script to start another (https://www.linuxquestions.org/questions/linux-newbie-8/using-parameters-from-one-bash-script-to-start-another-4175596766/)

aristosv 01-04-2017 04:29 AM

using parameters from one bash script to start another
 
In the scripts below, xinit is used to start midori. But as you can see there are some parameters in the first and in the second script. So my question is:

How does "DISPLAY=:0.0", "xinit" and "-- -nocursor" affect each line in start-browser.sh?
I am trying to figure out the logic behind structuring these scripts this way, and why is the first script needed, to start the second script (except from throwing it in the background)

And what if I wanted merge these two scripts? Would this be possible, and how?

process-browser.sh
Code:

#!/bin/bash
DISPLAY=:0.0 sudo xinit $config/start-browser.sh -- -nocursor > /dev/null 2>&1 &

start-browser.sh
Code:

#!/bin/bash
xset -dpms
xset s off
xset s noblank
matchbox-window-manager &
midori -e Fullscreen -a $browserurl


pan64 01-04-2017 04:57 AM

you would need to read at least the man page of xinit. How it works and how should you pass variables. For example instead of DISPLAY=:0.0 you need to use -display.
what do you mean by merge these two srcipts?

aristosv 01-04-2017 05:20 AM

What I am trying to understand is, how each command/parameter in the first script, affects each command in the second script. So if I was to join these two scripts, would this work?

Code:

#!/bin/bash
DISPLAY=:0.0 sudo xinit -- -nocursor xset -dpms
DISPLAY=:0.0 sudo xinit -- -nocursor xset s off
DISPLAY=:0.0 sudo xinit -- -nocursor xset s noblank
DISPLAY=:0.0 sudo xinit -- -nocursor matchbox-window-manager &
DISPLAY=:0.0 sudo xinit -- -nocursor midori -e Fullscreen -a $browserurl

It wouldn't, but why?

Do I have to research this, depending on which commands are used in both scripts? What's the logic behind using the first script, to call the second script?

pan64 01-04-2017 05:41 AM

please read the man page of xinit. It is explained well.
The xinit program is used to start the X Window System server - and obviously you want to start only one X server, using one DISPLAY.
The client programs you want to start is your shell script.

ondoho 01-04-2017 08:57 AM

can't you just use startx and ~/.xinitrc instead?
and are you sure you have to use sudo for xinit???

e.g. like this:
~/.xinitrc:
Code:

#!/bin/sh

xset -dpms
xset s off
xset s noblank

exec matchbox-window-manager &
wm_pid=$!
{
 browserurl="https://google.com/"
 . midori -e Fullscreen -a $browserurl
} &
wait $wm_pid

and then just start X with
Code:

exec startx


All times are GMT -5. The time now is 03:36 PM.