wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

POPQuiz-BashShell

Total questions: 12

Worksheet time: 6mins

Name
Class
Date
1.

To change mode of myfile to 'rwxr–r–' , the command used is

a)

Chmod(myfile,0742).

b)

Chmod(myfile,0474).

c)

Chmod(myfile,0747).

d)

Chmod(myfile,0744)

2.

How can you get/set an environment variable from a program?

a)

Getenv() and putenv()

b)

Getenv() and setenv()

c)

Readenv and putenv()

d)

Readenv() and setenv()

3.

How do you find out what’s your shell?

a)

Whomami

b)

Pwd

c)

Echo $SHELL

d)

$sh

4.

A comment line in a script begins with 

a)

#

b)

$

c)

^

d)

&amp

5.

Which of the following symbols is used as prefix to access the value of variables in scripting 

a)

#

b)

$

c)

^

d)

&amp

6.

How can you append the output of a command to a file?

a)

Command > file

b)

Command >> file

c)

Command <> file

d)

Command < file

7.

Which of the following is not a kind of shell 

a)

bash

b)

ksh

c)

csh

d)

dsh

8.

How do you delete a file?

a)

Rm filename

b)

Dl filename

c)

Touch filename

d)

Less filename

9.

[ is equivalent to

a)

test

b)

for

c)

while

d)

then

10.

In Shell scripting What does does $? Return?

a)

$? will return exit status of command .0 if command gets successfully executed ,non-zero if command failed.

b)

$? will return exit status of command .Non-0 if command gets successfully executed ,zero if command failed

c)

System error

d)

Invalid command

11.

How do you read arguments in a shell program?

a)

$0 would be the first line argument, $1 would be the Second command line argument, $2 the Third, and so on

b)

$1 would be the first command line argument, $2 the second, and so on $0 is the name of the script or function

c)

above are correct

d)

above are incorrect

12.

How do you get all files with on the 3rd place an r, g or i?

a)

Ls ?3[rgi]*

b)

Ls [rgi]

c)

Ls [..i*]

d)

Ls ??[rgi]*