Page 1 of 1

Bash help

Posted: Fri Aug 24, 2012 6:36 pm
by biwa7636
New to bash. Appreciate your reading.
--------------------------------------------------------------------
We can type in

Code: Select all

midori web1.com web2.com web3.com
to open different websites/local html in a same window but different tabs.
1.How can I write a bash script to loop through the a directory containing html files and maybe, list all the file names in a WEBLIST file
2.How to use commandline to use midori call that WEBLIST file and open them together.

Re: Bash help

Posted: Fri Aug 24, 2012 8:03 pm
by bredman
There is no need to create a file, just put everything into a string

Code: Select all

#!/bin/bash

#Start with an empty list
list=""

#Loop through every html file in /home/pi/web
for file in $( ls /home/pi/web/*.html );
do
  #Add a space and the file name to the end of the list
  list=$list" "$file;
done
#Launch Midori with the list of files
midori $list
Please be VERY careful with spaces, bash is very particular about spaces.