ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Command-line argument - Wikipedia, the free encyclopedia

Command-line argument

From Wikipedia, the free encyclopedia

In computer command line interfaces, a command line argument is an argument sent to a program being called. In general, a program can take any number of command line arguments, which may be necessary for the program to run, or may even be ignored, depending on the function of that program.

For example, in the popular Unix environment, an example of a command-line argument is:

rm file.s

"file.s" is a command line argument which tells the program rm to remove the file "file.s".

Programming languages such as C, C++ and Java allow a program to interpret the command line arguments by handling them as string parameters in the main function.

[edit] Command-line switch

A command line switch or simply switch (also known as a flag, an option, or a command line parameter) is an indication by a user that a computer program should change its default behaviour.

For example, in the OpenVMS operating system, the command directory is used to list the files inside a directory. By default—that is, when the user simply types directory—it will list only the names of the files. By adding the switch /owner (to form the command directory/owner), the user can instruct the directory command to also display the ownership of the files.

The format of switches varies widely between operating systems. Under the OpenVMS operating system, switches are entered in the form command/switch_1/switch_2/switch_3=value etc. The form /switch=value is used to provide an argument to the switch; for example, /user=john might specify that only files owned by the user "john" should be displayed.

MS-DOS and related operating systems typically use single-letter switches, for example dir/w/p/a:s. In this case, the : character serves the same purpose as = above.

Traditionally, MS-DOS is similar to the Unix operating system; switches are single letters or digits, and introduced via a - (hyphen); e.g. ls -l -F -a -1. When options are given in this form (a dash and then a letter or word), they are more often called flags - as in compiler flags. Multiple flags may be combined into one, so the previous command could be rewritten ls -lFa. However, with the increasingly widespread use of software from the GNU project, particularly in the Linux operating system, GNU's long options are also widely used. Long options are introduced via --, and are typically whole words. For example, ls --long --classify --all. Arguments to long options are provided with =, as ls --block-size=1024. Some Unix programs use long options with single dashes, for example MPlayer as in mplayer -nosound.

GNU also uses -- to terminate option lists. For example, an attempt to delete a file called -file1 by using rm -file1 may produce an error, since rm may interpret -file1 as a command line switch. Using rm -- -file1 removes ambiguity.

Languages


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -