Unix - Shell Programming

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

flashcard set

Earn XP

Description and Tags

These flashcards cover key concepts from the Unix Shell Programming lecture, focusing on shell syntax, commands, and control flow.

Last updated 3:50 PM on 10/14/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

21 Terms

1
New cards

What is the first line to specify which shell to use in a shell script?

!/bin/bash or #!/usr/bin/perl.

2
New cards

What symbol is used to denote a comment in a shell script?

.

3
New cards

What does the variable $0 represent in shell scripting?

The name of the running program.

4
New cards

How do you perform arithmetic in shell scripting?

Using $(( )) with expressions.

5
New cards

What does a return value of 0 indicate in shell programming?

Success or True.

6
New cards

What is the significance of using single quotes in shell scripting?

Single quotes do not interpret any variables.

7
New cards

What command is used to read user input into variables in shell scripting?

read var1 var2 …

8
New cards

What keyword starts a conditional block in shell scripting?

if.

9
New cards

How is a for loop structured in shell scripting?

for VAR in LIST; do; STATEMENTS; done.

10
New cards

What does the expression [ -x filename ] check in a shell script?

It checks if the filename is executable.

11
New cards

What does the until loop do in shell scripting?

It executes statements until a specified condition is true.

12
New cards

What does the special variable $# represent?

The total number of command line arguments.

13
New cards

What is the function of the test command in shell scripting?

To check if certain conditions are true.

14
New cards

What is the structure of the 'if-else' statement in shell scripting?

if [ CONDITION ]; then; STATEMENTS-YES; else; STATEMENTS-NO; fi.

15
New cards

What type of quotes interpret variables in shell scripting?

Double quotes (" ").

16
New cards

In a for loop, what does the 'do' keyword signify?

It marks the beginning of the statements that will be executed for each item in the list.

17
New cards

What does the expression test ! -x tFile do?

It checks if tFile is not executable.

18
New cards

What should you do if you want to perform commands based on whether conditions are true in shell scripting?

Use control flow statements like 'if' and 'case'.

19
New cards

What are command line parameters and how are they accessed in shell scripts?

Parameters given at execution and accessed via special variables like $1, $2, etc.

20
New cards

What does the command expr do in shell scripting?

It evaluates expressions, often used for arithmetic operations.

21
New cards

What are the three types of loops discussed in shell scripts?

For loop, While loop, Until loop.