LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-09-2004, 10:24 AM   #1
mooreted
Member
 
Registered: May 2003
Posts: 598

Rep: Reputation: 30
Bash Scripting--Simple Question


If I type "xine *.avi" at the CLI, Xine will load all the AVI files in the directory and play them one at a time. So I thought it would be nice to write a shell script that does this for me, then I could just click on the script and do the same thing. So why doesn't my script work?

Error message: Input plugin failed to open mrl "*.avi"

Here is my script:

#!/bin/bash
xine *.avi

You would think if it worked from the CLI, it would work in the script. Of course I am still used to DOS batch files.
 
Old 05-09-2004, 10:59 AM   #2
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 57
There is no wildcard expansion when you type it like that in a script. Try something like this instead:
Code:
#!/bin/bash
files=`ls *.avi`         # note backticks for command substitution
xine $files
...or
Code:
#!/bin/bash
for flick in *.avi
do
    xine "$flick"
done
Håkan
 
Old 05-10-2004, 10:34 AM   #3
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
Thanks. I really need to get a good book on bash programming.
 
Old 05-10-2004, 12:51 PM   #4
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 57
Then look no further than the Advanced Bash Scripting Guide, also available online at tldp.org but I prefer having a locally stored copy.


Håkan
 
Old 05-10-2004, 01:44 PM   #5
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
Wow, thanks. That was easy. I thought I'd have to go to the bookstore.

Have a good day,
Ted.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very simple BASH scripting question clickster Linux - Newbie 6 11-23-2005 04:28 PM
Simple Shell Scripting Question hellomynameisphil Programming 2 08-27-2005 03:41 AM
Simple bash/awk/sed scripting question R00ts Programming 4 04-16-2005 02:55 AM
simple scripting question wedgeworth Programming 6 02-04-2004 10:30 AM
Bash Scripting Question Rezon Programming 2 10-30-2003 10:16 AM


All times are GMT -5. The time now is 01:09 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration