LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2009, 07:32 PM   #1
Leon14344
LQ Newbie
 
Registered: Jun 2009
Posts: 17

Rep: Reputation: 0
Bash script to open an image when connecting to a network?


I have no real experience with bash ( just HTML, Javascript, Java, Perl, and Python)...but I was wondering it there was a script I could run that, when I connect to a network ( like my campus' wifi netowrk), shows an image in a window?

It's not really important of course, more curious than anything. It would be a cool custom thing I think. And besides, if there is, it could get me started using bash.
 
Old 10-20-2009, 07:46 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by Leon14344 View Post
I have no real experience with bash ( just HTML, Javascript, Java, Perl, and Python)...but I was wondering it there was a script I could run that, when I connect to a network ( like my campus' wifi netowrk), shows an image in a window?

It's not really important of course, more curious than anything. It would be a cool custom thing I think. And besides, if there is, it could get me started using bash.
not in a graphics mode windows but text mode in the current terminal
 
Old 10-20-2009, 08:17 PM   #3
Leon14344
LQ Newbie
 
Registered: Jun 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Ah, alright. I learned awhile back how to set an alarm using bash to play an mp3, and figured maybe it would open an image as well. Thanks.
 
Old 10-20-2009, 08:33 PM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
these may help
http://www.slac.stanford.edu/xorg/nm...tools.html#map
http://blog.felipecruz.com/blog/bash-scripts/
http://www.google.com/webhp?hl=en#hl...431b543f067006
 
Old 10-21-2009, 12:00 AM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,501

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
You can easily use bash to open an image. The following works on local computer:

firefox "file:/home/joebob/MyScripts/picture.jpg"

Use firefox or whatever web browser and complete path. I think you need the double quotes, not sure. If you want to do this when you connect to a network, where would the image be? Not really sure I understand what you want.

Last edited by yancek; 10-21-2009 at 12:02 AM.
 
Old 10-22-2009, 04:04 PM   #6
Leon14344
LQ Newbie
 
Registered: Jun 2009
Posts: 17

Original Poster
Rep: Reputation: 0
I'm not even that sure what i want, as I was never even aware that i could do it.

I guess the pic would be in the regular Pictures folder ( using Ubuntu 8.10 and Slackware 12.2 btw), or I would place it in a "MyScripts" folder like your example shows. It doesn't really matter right now, and I could edit as I wished. I just don't know how to set something like that up in Bash.
 
Old 10-22-2009, 11:54 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,501

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
If your using bash, just create a file in your text editor, using the example from above:

Code:
#!/bin/bash

firefox "file:/home/joebob/MyScripts/picture.jpg"
Make it executable, it should work. Well, it worked for me anyhow.
 
  


Reply



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
Opening and saving an image file in a bash script Dralnu Programming 5 06-16-2009 01:23 PM
Command line image viewing for bash script? Romanus81 Programming 3 08-10-2008 11:39 PM
Bash script to sort image files dtcs Programming 5 09-26-2006 09:50 PM
Bash script to do copying and ISO image creating, etc. satimis Programming 2 09-19-2004 09:47 PM
Image Comparison With Bash Script smcallis Programming 4 06-30-2004 12:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:51 PM.

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