APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2003/09/24 argument, args

© September 2003 Tony Lawrence

A value passed to a program. Abbreviated to args, but usually only in the plural. It's fairly common to specifically say "command line arguments". Arguments read from a file are often referred to as "parameters" rather than arguments. Flags (also "switches") are a type of argument, almost always prefaced by some character that tells you that: typically a "-" in Unix and Linux, and a "/" (the "switch character") in the Windows world. So, in

sort -u /tmp/file

most geekish types would say that "-u" (sort uniquely) is a flag, and /tmp/file is an argument. But remember that a flag is a type of argument; "/tmp/file" would never be a flag, but "-u" will be called an argument in some contexts.

A very few Unix programs process flags with or without the lead-in character: both "tar tvf /dev/rct0" and "tar -tvf /dev/rct0" are acceptable.

Most Unix programs will accept file arguments or read from standard input: you can "cat file | sort" or "sort file" with equal results.

Unix shells are responsible for expanding wild-cards and passing the result to the program that will use them. So when you say

cp x* /tmp

"cp" sees all the "x" files; it does not see "x*".

Sometimes you don't want the shell expansion of wildcards. Using "find -name x*" will fail if there are any files named "x*" in the current directory. You need to "find -name 'x*'" so that find gets the actual wildcard to work with.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> What does 'argument or args' mean to a programmer?

Inexpensive and informative Apple related e-books:

Take Control of Parallels Desktop 12

Take Control of iCloud, Fifth Edition

Take Control of Automating Your Mac

Take Control of Upgrading to El Capitan

El Capitan: A Take Control Crash Course

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

There are only two hard problems in computer science: cache invalidation and naming things. (Phil Karlton)

Linux posts

Troubleshooting posts

This post tagged:




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode