Docsity

2026 Verified Detailed Linux Shell Scripting Practice Examination Study Guide with Compr,, Exams of Computer Science

Toggle sidebar
bg1
2026 Verified Detailed Linux Shell Scripting
Practice Examination Study Guide with
Compr, Exams of Computer Science Graded
A+| Reliable Successs Rate.
Shell Scripting Relevance - ANSWER-1. Create own Commands
2. Save time on data and job management
3. Task automation
Unix based system architecture - ANSWER-1. CPU
2. KERNEL
3. SHELL
4. PROGRAMS
5. APPLICATIONS
KERNEL - ANSWER-Resource allocation
PROGRAMS - ANSWER-1. List processors
2. Text processors
3. Programmer's tools
4. Programming Languages
5. Networks and Communications
Two Key Components of Shell Scripts - ANSWER-1. UNIX/LINUX
commands
2. Shell programming syntax
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download 2026 Verified Detailed Linux Shell Scripting Practice Examination Study Guide with Compr, and more Exams Computer Science in PDF only on Docsity!

2026 Verified Detailed Linux Shell Scripting

Practice Examination Study Guide with

Compr, Exams of Computer Science Graded

A+| Reliable Successs Rate.

Shell Scripting Relevance - ANSWER -1. Create own Commands

  1. Save time on data and job management
  2. Task automation Unix based system architecture - ANSWER -1. CPU
  3. KERNEL
  4. SHELL
  5. PROGRAMS
  6. APPLICATIONS KERNEL - ANSWER -Resource allocation PROGRAMS - ANSWER -1. List processors
  7. Text processors
  8. Programmer's tools
  9. Programming Languages
  10. Networks and Communications Two Key Components of Shell Scripts - ANSWER -1. UNIX/LINUX commands
  11. Shell programming syntax

First line of a shell script - ANSWER -#!/bin/bash Comments in shell - ANSWER -# Components of chmod - ANSWER -Category of user (user, group, other, all) Operation (+, -, =) Permission type (Read, write, execute) Tells unix that the file is executable - ANSWER -chmod u+x file.sh chmod +x file.sh Execute the shell script called file.sh - ANSWER -./file.sh

. file.sh source file.sh sh file.sh Quote Characters - ANSWER -1. Double Quote

  1. Single Quote
  2. Back Quote Double Quote " " - ANSWER -Weak quote If a string is enclosed in "" then the references to the variables (like $variable) are replaced by their values. \ characters are treated specially

Read permission - ANSWER -ls can read the list of filesnames stored in that directory Write permission - ANSWER -Permitted to create or remove files within the directory Execute permission - ANSWER -User is permitted to pass through the directory in searching for subdirectories Programming features of the UNIX/LINUX shell - ANSWER -1. Shell variables

  1. Operators
  2. Logic Structures Shell Variables - ANSWER -Symbolic names that can access values stored in memory Types of Shell Variables - ANSWER -1. Global Variables
  3. Local Variables
  4. Special Variables Global Variables - ANSWER -Environment and configuration variables, capatalized HOME, PATH, SHELL, DISPLAY, PWD

Local Variables - ANSWER -Within a shell script you can create as many as are needed. They exist only within that particular shell Special Variables - ANSWER -Positional parameters $1, $2.. echo $1 refers to the first string after the name of the script file Operators - ANSWER -Shell scripts support many operators, including those for performing mathematical operations 3 Groups of Operators - ANSWER -1. Defining and evaluating operators

  1. Arithmetic Operators
  2. Redirecting and piping Operators Defining and Evaluating Operators - ANSWER -variable=value $ set x=37; echo $x $ unset x; echo $x Logic Structures - ANSWER -1. Sequential Logic - for performing a series or commands
  3. Decision Logic - for branching from one part of a script to another
  4. Looping Logic - for repeating a command several times
  5. Case Logic - for choosing an action from several possible alternatives Shows a list of your environment variables - ANSWER -printenv

Positional Parameters - ANSWER -When a shell script is executed with command line arguments, each argument is copied into special variables that can be accessed Variable that contains the name of the script - ANSWER -$ Command line parameter - ANSWER -$1, $2..... Number of command line parameters - ANSWER -$# process ID of the shell - ANSWER -$$ Return exit code of the last command - ANSWER -$? Shift Command - ANSWER -Shifts the positional parameters by one towards the beginning and drops $1 from the list, so that $ becomes $1 and so on List all the positional parameters one by one (across screen) - ANSWER -$* List all the positional parameters - ANSWER -$@ TESTS IN SHELL SCRIPTING - ANSWER - int1 -eq int2 - ANSWER -Test identity

int1 -ne int2 - ANSWER -Test inequality int1 -lt int2 - ANSWER -Less than int1 -gt int2 - ANSWER -Greater than int1 -le int2 - ANSWER -Less than or equal to int1 -ge int2 - ANSWER -Greater than or equal to s1 = s2 OR s1 == s2 - ANSWER -Tests equality s1 != s2 - ANSWER -Tests inequality string OR -n string - ANSWER -Returns exit status 0 if string isn't null -z string - ANSWER -Returns exit status 0 if string is null Equivalent to &&/|| - ANSWER --a and -o [ ] - ANSWER -Used to test Test if file is a directory - ANSWER --d file