SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Parameter Fun


Parameter Fun

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)

Group: Administrators
Points: 689860 Visits: 21594
Comments posted to this topic are about the item Parameter Fun

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
ildjarn.is.dead
ildjarn.is.dead
SSChasing Mays
SSChasing Mays (609 reputation)SSChasing Mays (609 reputation)SSChasing Mays (609 reputation)SSChasing Mays (609 reputation)SSChasing Mays (609 reputation)SSChasing Mays (609 reputation)SSChasing Mays (609 reputation)SSChasing Mays (609 reputation)

Group: General Forum Members
Points: 609 Visits: 205
For Unix tools, the usual convention is that a single dash is for 1-letter parameters, and the double-dash for full named parameters (e.g. -h and --help, or -v / --verbose)

/ for parameters is a Windows-ism, so it's not unexpected that it won't work on Unix.
peden
peden
SSC Journeyman
SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)SSC Journeyman (78 reputation)

Group: General Forum Members
Points: 78 Visits: 102

Linux is base on Unix, which was written by programmers for programmers. One of the beauties of Unix was how much work could be accomplished with very few keystrokes. Back in the day, there would not be "-?" as an argument for any Unix command. There might be "-h". But if you really wanted to know about a command, say sqlcmd, you would use "man sqlcmd" to print the manual pages for sqlcmd on the screen.


Steve Jones
Steve Jones
SSC Guru
SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)SSC Guru (689K reputation)

Group: Administrators
Points: 689860 Visits: 21594
man command is something I used to use often. I just find it to be a poor design decision, but a clever one, that "-af" is "-a -f". It's short sighted to assume all parameters would be single character.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
patrickmcginnis59 10839
patrickmcginnis59 10839
SSC-Insane
SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)

Group: General Forum Members
Points: 22851 Visits: 8810
Steve Jones - SSC Editor - Monday, March 4, 2019 10:24 AM
man command is something I used to use often. I just find it to be a poor design decision, but a clever one, that "-af" is "-a -f". It's short sighted to assume all parameters would be single character.

http://www.catb.org/~esr/writings/taoup/html/ch10s05.html has a pretty good discussion. Seems like "dash followed by single character" isn't universal, the old X toolkit didn't use that convention.


to properly post on a forum:http://www.sqlservercentral.com/articles/61537/
cmullican
cmullican
SSC Veteran
SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)

Group: General Forum Members
Points: 256 Visits: 122
Steve Jones - SSC Editor - Monday, March 4, 2019 10:24 AM
man command is something I used to use often. I just find it to be a poor design decision, but a clever one, that "-af" is "-a -f". It's short sighted to assume all parameters would be single character.

That's why the convention is --param for parameters that aren't single characters.

cmullican
cmullican
SSC Veteran
SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)

Group: General Forum Members
Points: 256 Visits: 122
I should unpack that a little more. The fundamental Unix conventions were established in the 1960s and 1970s, when computers were far more limited in CPU, memory, and network bandwidth. Every keystroke counted; being able to type 'ls -slApF' instead of 'ls -s -l -A -p -F' was a significant savings in time and resources (nevermind 'ls --size -l --almost-all --indicator-style=slash --classify', which wasn't even an option in the early days!). Was it hard to read? Sure, but it worked! Cheat sheets were common, but any command one used frequently became second nature, plus 'alias' let you encapsulate a longer command in a short string.

Over time, as bandwidth increased and other resources became more plentiful, readability and memorability became bigger concerns, and some commands started running out of single letters that were in use, especially letters that had any connection to the parameter. But breaking everything that used the original format -- including user habits -- would be a really bad idea, so the -- predicate for multi-character parameters was introduced. The most commonly used options still have short names for efficiency; less-common options may only have a long name, and many options have both, because there's more than one way to do it, as Perl programmers say.

I'm oversimplifying a bit -- other conventions have been used and sometimes still are; some tools use a - for all parameters and don't allow combining, some use +/- to turn options on/off, etc. -- but that's the general idea.

'/' is a directory separator in Unix, so it would not work well as a parameter predicate.
patrickmcginnis59 10839
patrickmcginnis59 10839
SSC-Insane
SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)

Group: General Forum Members
Points: 22851 Visits: 8810
cmullican - Monday, March 4, 2019 3:44 PM
I should unpack that a little more. The fundamental Unix conventions were established in the 1960s and 1970s, when computers were far more limited in CPU, memory, and network bandwidth. Every keystroke counted; being able to type 'ls -slApF' instead of 'ls -s -l -A -p -F' was a significant savings in time and resources (nevermind 'ls --size -l --almost-all --indicator-style=slash --classify', which wasn't even an option in the early days!). Was it hard to read? Sure, but it worked! Cheat sheets were common, but any command one used frequently became second nature, plus 'alias' let you encapsulate a longer command in a short string.

Over time, as bandwidth increased and other resources became more plentiful, readability and memorability became bigger concerns, and some commands started running out of single letters that were in use, especially letters that had any connection to the parameter. But breaking everything that used the original format -- including user habits -- would be a really bad idea, so the -- predicate for multi-character parameters was introduced. The most commonly used options still have short names for efficiency; less-common options may only have a long name, and many options have both, because there's more than one way to do it, as Perl programmers say.

I'm oversimplifying a bit -- other conventions have been used and sometimes still are; some tools use a - for all parameters and don't allow combining, some use +/- to turn options on/off, etc. -- but that's the general idea.

'/' is a directory separator in Unix, so it would not work well as a parameter predicate.


I like using the convention of calling the -[char], --[keyword] etc switches or options, after all many commands have positional parameters too and it helps to keep them separate when putting together command lines. Obviously some switches have their own parameters too. I know thats probably just personal preference, but knowing that switches and parameters have a somewhat different meaning has helped me put together some working command lines with utilities that had lots of options and multiple parameters but will only offer something like "bad parameters" as a troubleshooting aid :-)

to properly post on a forum:http://www.sqlservercentral.com/articles/61537/
cmullican
cmullican
SSC Veteran
SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)

Group: General Forum Members
Points: 256 Visits: 122
patrickmcginnis59 10839 - Monday, March 4, 2019 4:13 PM

I like using the convention of calling the -[char], --[keyword] etc switches or options, after all many commands have positional parameters too and it helps to keep them separate when putting together command lines. Obviously some switches have their own parameters too. I know thats probably just personal preference, but knowing that switches and parameters have a somewhat different meaning has helped me put together some working command lines with utilities that had lots of options and multiple parameters but will only offer something like "bad parameters" as a troubleshooting aid :-)

Fair enough. "Parameter" was used throughout the previous posts in the thread, so I stuck with it. I try to provide more useful error messaging when I control that; if I don't control it, I'm at the mercy of whatever terminology the developer chose anyway.
Chris Wooding
Chris Wooding
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3855 Visits: 1640
Steve Jones - SSC Editor - Monday, March 4, 2019 10:24 AM
man command is something I used to use often. I just find it to be a poor design decision, but a clever one, that "-af" is "-a -f". It's short sighted to assume all parameters would be single character.

It seems pretty reasonable to me - how many commands take more than 26 parameters?

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search