Merge two bash scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Merge two bash scripts
# 1  
Old 12-26-2016
Merge two bash scripts

I am currently running the following two bash scripts, in order to start x, matchbox and midori on the raspberry pi hdmi, using a remote ssh session.
start-browser
Code:
#!/bin/bash
# import variables
source /var/rpi/scripts/config/variables/general
echo "starting browser"
DISPLAY=:0.0 sudo xinit $config/play/play-browser -- -nocursor > /dev/null 2>&1 &

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

I would like to merge these two scripts into one. I tried a few things but I keep getting errors from x.
How can I merge these two scripts?
Thanks
# 2  
Old 12-28-2016
Quote:
Originally Posted by aristosv
I am currently running the following two bash scripts, in order to start x, matchbox and midori on the raspberry pi hdmi, using a remote ssh session.
start-browser
Code:
#!/bin/bash
# import variables
source /var/rpi/scripts/config/variables/general
echo "starting browser"
DISPLAY=:0.0 sudo xinit $config/play/play-browser -- -nocursor > /dev/null 2>&1 &

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

I would like to merge these two scripts into one. I tried a few things but I keep getting errors from x.
How can I merge these two scripts?
Thanks
Put one script under the other using vi's r second_script
or cat script1 script2 >combined.

edit combined to eliminate the second
Code:
#!/bin/bash
# import variables

I did not see anywhere where $variables were being setup.

Last edited by rbatte1; 12-30-2016 at 05:30 AM.. Reason: Added CODE tags
# 3  
Old 12-29-2016
But the first one calls the second one. Its not as simple as copy/paste the one into the other.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash -c interactive scripts

i have to run the following script through a pipe: script.sh: #!/bin/bash echo "Hello World" echo -e "The \033 here's how its currently being run: bash -c "$(cat script.sh)" This is an interactive script. the problem is, when i run it this way, if you go to another terminal and... (4 Replies)
Discussion started by: SkySmart
4 Replies

2. Shell Programming and Scripting

Bash interactive scripts

i have a script that contains: script.sh #!/bin/bash echo -e "\t\t\t0. Exit" echo -e "\t\t\t1. Help" echo -e "\t\t\t2. Notes" echo -e "\t\t\t3. Classes" echo "${newline}" echo -n -e "\t Please enter option number : " read Type case $Type in 1) clear ... (1 Reply)
Discussion started by: SkySmart
1 Replies

3. Shell Programming and Scripting

Merge values from multiple directories into one file in awk or bash

I am trying to merge or combine all $1 values in validation.txt from multiple directories into one new file and output it here tab-delimited:/home/cmccabe/Desktop/20x/total/total.txt. Each $2 value and the header would then be a new field in total.txt. I am not sure how to go about this as cat is... (2 Replies)
Discussion started by: cmccabe
2 Replies

4. Shell Programming and Scripting

Parallel bash scripts

Need some help to replace bash script with parallel to speed up job on multiple files (400files.list is the file contains the absolute path to those 400 files). The bash script is to run the same program over the files repetitively. My bash_script.sh is: for sample in `cat 400files.list`; do... (3 Replies)
Discussion started by: yifangt
3 Replies

5. Shell Programming and Scripting

Bash/shell merge similar lines

Hello, I've been working on a bash script to parse through firewall logs (cisco). I'm nearing the end and have a dilemma. My data looks as such (actual data is several gigs worth of logs - without the headers): sourceIP destinationIP destinationProtocol destinationPort 1.1.1.1 2.2.2.2 ... (2 Replies)
Discussion started by: umang2382
2 Replies

6. Shell Programming and Scripting

doxygen and bash scripts

I am trying to have doxygen documenting my bash scripts by setting the following in my Doxyfile FILE_PATTERNS = *.sh *.awk INPUT_FILTER = "sed -e 's|##|//!|'" FILTER_SOURCE_FILES = YES # Set path to bash scripts V=$(readlink -f"$0") bashpath="${V%/*}" # Set ANSI color... (0 Replies)
Discussion started by: kristinu
0 Replies

7. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

8. Shell Programming and Scripting

GUI for bash scripts?

Hello everyone! I'm looking for a way to build a GUI for various bash scripts I've written. Is there any "good" way to do it? I've heard about python/gtk+,qt and other stuff, but I've absolutely no idea where I should look at. Thanks a lot in advance! Regards, xenator EDIT: ... (1 Reply)
Discussion started by: xenator
1 Replies

9. Shell Programming and Scripting

Nonblocking I/O in bash scripts

Hello, Is there a way to perform nonblocking I/O reads from standard input in a bash script? For example, in C, you can say: int flags = fcntl(STDIN_FILENO, F_GETFL); fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK); ch = fgetc(stdin); the 'fgetc' function will not block on... (5 Replies)
Discussion started by: neked
5 Replies
Login or Register to Ask a Question