LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-18-2011, 04:32 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,543

Rep: Reputation: 51
A point in syntax in GNU programs.


Hi:

For some commands the command synopsis (syntax) is given like this:
command [a|b] [args ...]
I take mplayer (perhaps not GNU) to illustrate the point:
mplayer [cdda|cddb]://track[-endtrack][:speed][/device] [options]
mplayer [dvd|dvdnav]://[title|[start_title]-end_title] [options]

An item inside square brackets is optional. The pipe sign is the 'or' logical connective (disjunction). But then, what is [cdda|cddb]?
If optional, I can omit it: it makes no sense because there are more the one possible synopsis for the command line. Any clue?
 
Old 06-18-2011, 04:57 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,505

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
I am not sure I understand the question as you seem to have already answered it??

[] - optional

| - you can use this one or that one

[cdda|cddb] - both of these are optional but you can only use cdda OR cddb

Where is the confusion?
 
Old 06-18-2011, 05:51 AM   #3
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 97
Quote:
Originally Posted by stf92 View Post
But then, what is [cdda|cddb]?
That means you can use "mplayer", "mplayer cdda" or "mplayer cddb".
It's like you described it. The parts inside square braces are
optional, and items separated by pipes are mutually exclusive (in
other words you must pick exactly one item from the list).
 
Old 06-18-2011, 06:00 AM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,543

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by carltm View Post
That means you can use "mplayer", "mplayer cdda" or "mplayer cddb".
I think I now understand. My confussion arises from this: if I want to play either a CDDA or a CDDB, then I must use, among the many synopsis given by the manual, that stated in post #1. But if I do mplayer ://1 I get "Failed to open ://1". I should have inferred that Mplayer is thinking I am using another synopsis. Well... I understand my self, and that's the important thing. But I wouldn't have done it with you. Thanks.

Last edited by stf92; 06-18-2011 at 06:07 AM.
 
Old 06-18-2011, 02:06 PM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,328

Rep: Reputation: 254Reputation: 254Reputation: 254
I don’t user mplayer, but shouldn't it be [(cdda|cddb)://] if it’s not optional but exactly one of cdda or cddb has to appear in combination with ://? Optional syntax would be [cdda://|cddb://].
 
Old 06-18-2011, 04:01 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,543

Original Poster
Rep: Reputation: 51
The problem, if there is one, is that there are other synopsis. Take these two, for instance:
mplayer [options] [file|URL|playlist|-]
mplayer [options] file1 [specific options] [file2] [specific options]
In fact, neither cdda nor cddb is mandatory, as you can see from the example.
 
Old 06-18-2011, 04:07 PM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,328

Rep: Reputation: 254Reputation: 254Reputation: 254
Quote:
Originally Posted by stf92 View Post
In fact, neither cdda nor cddb is mandatory, as you can see from the example.
Yes, but you complained about an error when you specify ://1. So, :// has to appear if and only if you request cdda or cddb in addition. The syntax of the orignal help implies indeed that :// has to be specified all the times.
 
Old 06-18-2011, 08:32 PM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,543

Original Poster
Rep: Reputation: 51
You are right. My examples were misleading.
 
  


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
Linking (ld) syntax and Floating Point crosscompile question Caesurus Linux - Software 0 06-08-2009 08:36 AM
LXer: LINFO Project Is Vital Starting Point For GNU/Linux Newcomers LXer Syndicated Linux News 0 11-08-2007 12:10 PM
gnu asm syntax? santana Programming 4 10-18-2007 10:25 AM
GNU Nano Syntax highlighting. oneman00 Linux - Software 2 12-10-2004 06:24 PM
Usage Syntax in Programs sovietpower Programming 1 09-07-2004 12:34 AM


All times are GMT -5. The time now is 09:00 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