recategorized by
1,727 views

1 Answer

0 0 votes

Shell scripts are compiled  ---- This is a wrong statement.

a programming language must provide the following services

  • comments,
  • variables,
  • conditional commands, and
  • repeated action commands.

These extra services are provided by the shell. Different shells use different syntax for these services. That means Shell is a programming language. 


Shell scripts are not compiled, rather, they are interpreted and executed by the shell itself.Shell scripts can also call compiled programs.

Now, Shell scripts can accept arguments.

We'll try to prove it by passing argument in command line.

Create a file named filename.sh

Here it is arg.sh

in the script write this program

then write
sh arg.sh sukanya das cse

it'll give output as 

Now, what's going on the program?

in the shell script(arg.sh)

$# ---> Store count of command line arguments

$* -----> Store all command line arguments

$0 -----> Store name of script itself

$1 ----> Store first command line argument

$2 ----> Store second command line argument

$3 -----> Store third command line argument

Now, when we write 

sh arg.sh sukanya das cse

$1 takes sukanya as 1st parameter

$2 takes das as 2nd parameter

$3 takes cse as 3rd parameter

So, Shell scripts can accept arguments.

edited by
Position:
Show:

Related questions

1 1 vote
1 answers 1 answer
598
598 views
gatecse asked Mar 2, 2018
598 views
The command cat x in unixis invalidcreates a file x and displays an error messagecreates a file x and waits for the user to give input from the keyboardnone of the above
0 0 votes
2 2 answers
675
675 views
gatecse asked Mar 2, 2018
675 views
The ________ information is used to limit the amount of recovery operations to be done following a system crash resulting in the lose of volatile storage Log Data file Ch...
0 0 votes
1 1 answer
449
449 views
gatecse asked Mar 2, 2018
449 views
Mutual exclusion problem occursbetween two disjoint processes that do not interactamong processes that share resourcesamong processes that do not use the same resource No...
0 0 votes
1 answers 1 answer
3.4k
3.4k views
gatecse asked Mar 2, 2018
3,423 views
Suppose that a process is in "BLOCKED" state waiting for some I/O service, when the service is completed, it goes toReady stateRunning stateTerminated stateSuspended stat...