Posts: 24
Joined: Mon Aug 06, 2012 2:23 pm

Bash help

Fri Aug 24, 2012 6:36 pm

New to bash. Appreciate your reading.
We can type in

Code: Select all

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.

Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Bash help

Fri Aug 24, 2012 8:03 pm

There is no need to create a file, just put everything into a string

Code: Select all


#Start with an empty list

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

Return to “General discussion”