LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-04-2017, 04:29 AM   #1
aristosv
Member
 
Registered: Dec 2014
Posts: 215

Rep: Reputation: 3
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
 
Old 01-04-2017, 04:57 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,604

Rep: Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604
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?
 
Old 01-04-2017, 05:20 AM   #3
aristosv
Member
 
Registered: Dec 2014
Posts: 215

Original Poster
Rep: Reputation: 3
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?
 
Old 01-04-2017, 05:41 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,604

Rep: Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604
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.
 
Old 01-04-2017, 08:57 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 17,403
Blog Entries: 10

Rep: Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214Reputation: 5214
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash script, pipe and parameters qrange Linux - Software 1 09-10-2015 03:43 AM
[SOLVED] bash script parameters and logic asistant Programming 17 04-19-2012 07:39 AM
[SOLVED] bash script sed -r -i and -e parameters charu Programming 10 05-06-2011 06:28 AM
Passing parameters to bash script Kamikazee Programming 4 10-01-2005 06:41 AM
Passing Parameters to Bash Script mooreted Linux - Software 3 04-05-2004 09:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration