LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-24-2008, 02:55 AM   #1
nymusicman
Member
 
Registered: Jun 2004
Location: Aurora, IL
Distribution: Slackware Current
Posts: 162

Rep: Reputation: 30
Script


I watch movies from my Desktop connected to my tv. I like to use my laptop as a "remote control" through vnc. In order to do that I use vlc like so:

vlc --x11-display :0.0 --fullscreen --no-wx-embed "whatever the file is"

This works really well for me, but I don't want to type this everytime I want to watch something and in all honesty I don't have it memorized so to shorten it I'd like to make a little bash script called vlc-vnc.

So far I have:

#!/bin/bash
vlc --x11-display :0.0 --fullscreen --no-wx-embed

The only problem is when I'm in the command prompt this script does not open the file and I'm not sure what to put at the end to allow the open the file I'm selecting. In other words I want to be able to say

vlc-vnc "file"

Please help.

Last edited by nymusicman; 01-24-2008 at 02:56 AM.
 
Old 01-24-2008, 03:13 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

The arguments you pass into a script are assigned to $<number>, so in your script, you can do:
Code:
#!/bin/bash
vlc --x11-display :0.0 --fullscreen --no-wx-embed "$1"
and it should work in the way you want.

Dave
 
Old 01-24-2008, 03:30 AM   #3
nymusicman
Member
 
Registered: Jun 2004
Location: Aurora, IL
Distribution: Slackware Current
Posts: 162

Original Poster
Rep: Reputation: 30
That is great, it worked.

However one thing I noticed, what if I wanted to open a directory of files for instance vlc-vnc *

When I tried that vlc only listed the first file and no more to the playlist. In other words what does the number that you choose to put in mean?
 
Old 01-24-2008, 04:16 AM   #4
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Can you try using $@ instead of $1 ?
I'm guessing the * will expand first, and is then passed to the script. Which is why you're getting only the first file.
$1 refers to the first argument (after the script name), $@ refers to all the args.
 
  


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
How to execute a ssh script on Linux server from Windows through a bat script? wanna13e Programming 13 10-23-2009 02:41 AM
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
i get an error message running php script inside a cgi script. repolona Linux - Software 0 02-22-2007 09:10 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:47 AM.

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