Skip to content

Command Line Argument

April 17, 2013
Passing more than one command on one command line

Syntax:
    command1;command2

To run two command with one command line the example is as follows:

    $ date; cal 2013

The following given above command will print today’s date and the calendar of year 2013.

Note : $ date cal 2013 is not a valid command line.

for this purpose, we must put semicolon (;) in between date and cal command.

Why Command Line argument is required?

The command line argument tells the command/utility which option to use with the shell command. It informs the utility or command which file or group of file is to process for reading/writing on file. 

For example we can use “rm” command, this command is used to remove file, but which file you want to remove and how you will tell this to rm command as follows:

         $ rm “file-name”

Here we have to specify the file name we want to remove. here “file-name” is first argument on command line.

Leave a Comment

Leave a comment