edited by
1,355 views

1 Answer

0 votes
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

Related questions

1 votes
1 votes
1 answer
1
gatecse asked Mar 2, 2018
338 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 votes
0 votes
2 answers
2
gatecse asked Mar 2, 2018
762 views
Bluetooth uses ____ method in physical layer to avoid interference from other devices or other networksFHSSFDSSTDSNone of the above
0 votes
0 votes
1 answer
3
gatecse asked Mar 2, 2018
393 views
In which of the following search agent operates by interleaving computation and action?Offline searchOnline searchBreadth first searchDepth first search
0 votes
0 votes
1 answer
4
gatecse asked Mar 2, 2018
374 views
Which of the following deals with the precise model where accurate solutions are achieved quickly?Soft computingMobile computingHard computingNone of the above