Font size
WorksheetsA+ - 19D - Identify Basics of Scripting
Total questions: 2
Worksheet time: 12mins
Shell scripting involves writing a series of instructions in the syntax of a particular language to perform tasks on a computer. There are three main types of coding languages: shell scripting languages, general-purpose scripting languages, and programming languages. Shell scripting languages use commands specific to an operating system, while general-purpose scripting languages use statements and modules independent of the operating system. Programming languages are used to compile executable files that can be installed on an OS and run as an app.
Shell scripting is often referred to as a glue language because it's used to automate and orchestrate functions across multiple OS and app software. Scripts can be developed in basic text editors, but using editors with script support or integrated development environments (IDEs) enhances productivity by providing syntax parsing, highlighting, autocomplete features, and debugging tools.
In Linux, shell scripts have a .sh extension and start with a shebang line that designates which interpreter to use, such as Bash or Ksh. Each statement in a script is typically added on separate lines. Shell scripts must have execute permission set to run, and they can be executed from the working directory or with a full path.
Basic script constructs include comments, variables, branches, and loops. Comments assist with maintaining code and are indicated by a special delimiter, typically a hash sign (#). Variables are labels for values that can change during script execution, while branches and loops allow for conditional execution and repeated statement blocks, respectively.
Windows supports several shell coding environments, including PowerShell, Visual Basic Script, and the CMD interpreter. PowerShell combines a script language with prebuilt modules called cmdlets for Windows and Active Directory management. Visual Basic Script is based on Visual Basic and is identified by the .vbs extension. Batch files use the .bat extension and are written for the basic Windows CMD interpreter.
JavaScript and Python are platform-independent scripting and programming languages. JavaScript is used for interactive web-based content and web apps, while Python is a general-purpose language for automation scripts and software apps. JavaScript files have a .js extension, and Python files have a .py extension.
Scripting is commonly used for automation, such as restarting machines, remapping network drives, installing applications, initiating updates, performing backups, and gathering information/data. Best practices for scripting include mitigating malware risks, preventing inadvertent system-setting changes, and avoiding browser or system crashes due to mishandling of resources.
Which of the following distinctions is NOT a helpful way to categorize coding languages?
Shell scripting language
General-purpose scripting language
Object-oriented programming language
Assembly language
What term describes the characteristic of shell scripting languages to automate and orchestrate functions across multiple OS and app software?
Glue language
General-purpose language
Integrated language
Universal language
Which file extension is commonly used for Linux shell scripts?
.py
.vbs
.bat
.sh
What is the purpose of a shebang line in a shell script?
To designate the programming language
To indicate the end of the script
To specify the execution permissions
To identify the script editor
Which scripting language combines a script language with prebuilt modules called cmdlets for Windows and Active Directory management?
JavaScript
Python
PowerShell
VBScript
What is the file extension for Visual Basic Script files?
.py
.vbs
.bat
.sh
Which scripting language is commonly used for interactive web-based content and web apps?
JavaScript
Python
PowerShell
VBScript
Which type of scripting language is used to compile an executable file that can be installed on an OS and run as an app?
Shell scripting language
General-purpose scripting language
Programming language
Integrated language
What construct in a script allows for the repeated execution of a statement block based on some type of condition?
Comments
Variables
Branches
Loops
Which operator in a test resolves to a TRUE or FALSE value?
Comparison operator
Arithmetic operator
Logical operator
Assignment operator
What term describes the characteristic of a scripting language to manipulate text and filter data from the output of commands?
Automation
Debugging
Parsing
Glueing
What is the primary use case for scripting?
Data visualization
Web development
Basic automation
Software debugging
What type of risk involves modifying the source code of a script to act in an adverse or insecure manner?
Inadvertent system-settings changes
Browser or system crashes
Malware risks
Mishandling of resources
What construct is used in Windows batch files to perform drive mapping?
New-PSDrive
Test-Path
net use
Get-PSDrive
Which type of scripting language is designed to automate and orchestrate functions of multiple different OS and app software?
Shell scripting language
General-purpose scripting language
Programming language
Integrated language
Which operator in a script tests whether the first positional parameter is unset or empty?
-z
-n
-eq
-It
What construct is used to declare a label for some value that can change during script execution?
Comments
Variables
Branches
Loops
What construct is used to execute a different sequence of instructions based on the outcome of some logical test?
Comments
Variables
Branches
Loops
Which scripting language is identified by the .py extension?
PowerShell
Visual Basic Script
JavaScript
Python
Have you submitted your Daily Standup Form yet?
Click the link below.
I have now
Not yet
