LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-23-2012, 06:45 PM   #1
davetesc
LQ Newbie
 
Registered: May 2012
Location: UK
Distribution: Debian testing KDE, Mint 14 XFCE, Ubuntu Studio
Posts: 19
Blog Entries: 4

Rep: Reputation: Disabled
Unhappy bash script problem, using zenity to file select m2t file for mplayer but don't work?


Using bash script I can use zenity to file select a video file, it returns file with full absolute path, I want to pass this to mplayer but get error message as if no filename passed to mplayer. Thought maybe mplayer quirk so tried mv $vidName video.m2t then mplayer video.m2t as quick work around but that doesn't work either. Think I'm missing something obvious but have tried all manner of quoting and brackets.
Any suggestions greatly appreciated.

Davetesc
 
Old 05-23-2012, 07:13 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Welcome to LinuxQuestion, Davetesc!

Difficult to tell what's the issue without looking at your script or the relevant lines of it. Something like this should work straightforward:
Code:
file="$(zenity  --title='Select a video to watch' --file-selection)"
mplayer "$file"
Does the file you selected contain spaces in its name? If this is the case, what if you select a file without spaces?
 
1 members found this post helpful.
Old 05-26-2012, 07:49 PM   #3
davetesc
LQ Newbie
 
Registered: May 2012
Location: UK
Distribution: Debian testing KDE, Mint 14 XFCE, Ubuntu Studio
Posts: 19
Blog Entries: 4

Original Poster
Rep: Reputation: Disabled
Thanks for that Colucix, I figured out what I was doing wrong a couple of hours before I got your msg. In my hurry to do something interesting with bash I breezed through the chapter on variables in the ABS guide missing the bit that said "DON'T put spaces arround the = when assigning variables! Oooops 2 months wasted tearing my hair out! I took out the space and added backticks , the line works as expected now.

vidN=`zenity --file-selection --filename=$CurrentDir`
echo "$vidN"
mplayer -fs "$vidN"

Had I not figured this out your post would have tipped me off so many, many thanks. Davetesc
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Help needed with bash script and zenity. Wizard^^ Programming 4 10-29-2010 11:01 PM
Awk script to select range from file jeesun Linux - General 8 11-26-2009 05:46 AM
Basic bash script question re: file size or # of lines in a file the_fornicator Programming 6 09-03-2009 10:41 AM
Bash script for listing FTP usage as the file name of a file created in each share jojothedogboy Programming 1 12-05-2008 04:35 PM
BASH Scripting - printing select lines in a file bullfrog1870 Linux - Newbie 16 11-08-2006 10:33 AM


All times are GMT -5. The time now is 11:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration