4.8 Scripting Flashcards
Identify the basics of scripting
Shell script
Text-based file that contains commands that can be interpreted and
presented to the computer
Batch file
Text-based file containing Windows commands and is interpreted from the command line environment
From where can batch files be operated?
The command-line environment
What is the naming scheme for PowerShell commandlets?
verb-noun
Advantage of PowerShell over batch files
Allows for more complex scripts
Give three things PowerShell can change/interact with
- Windows components
- Windows features
- Active Directory
Where does .vbs run from?
Inside other applications, mainly Office products
Describe how Linux Shell Script (.sh) works
Similar to a batch script inside of Windows
Where is JavaScript designed to be implemented?
Inside a web-based interface
Aside from websites and web apps, where is .js used?
Scripting languages on macOS desktops and servers
What systems can Python run on?
Windows, Mac and Linux
Why is Python considered an interpreted language?
Because it is cross-platform in nature
What three scripts only run on Windows
.vbs
.ps1
.bat
Boolean
A form of data with only two possible values (T or F)
Give the three names for a variable that stores a decimal number
Float, decimal, real number
Character variable
Can only store ASCII character
String
A variable that can store multiple characters
Give two features unique to pseudocode
- No need to define data type of each variable
- Variables can change throughout the program’s execution
Constant
Similar to a variable but cannot be changed within the program once it is defined
Loop
A type of flow control that controls which order the code will be executed in a given program
For loop
Used when the number of times to repeat a block of code is known
While loop
Used when the number of times to repeat a block of code is not known and will only stop when a certain event happens
Do loop
Used when an indefinite iteration needs to happen; will only stop until some condition is met at the end of the loop
Logic control
Provides conditions based on different logical tests
echo
Printing on screen
if [condition]
Logical construct
$1
Variable
How is network drive remapping done?
Within normal CLI using a batch file or PowerShell
What are APT and YUM?
Popular package management systems created for Debian-based and Red Hat-based Linux distributions, respectively
How do you run apt or yum?
BASH script
Bash script
A plain text file containing a series of commands
Give four commands that can be used for backup automation
- copy/xcopy/robocopy
- copy (cp)
- Windows Task Scheduler
- Crontab
List three possible negative consequences to be aware of when scripting
- Unintentionally introducing malware
- Inadvertently changing system settings
- Causing browser or system crashes due to mishandling resources
What is best practice when running a script?
Use the lowest permissions required
How can scripting result in hard drive storage space being depleted?
Because of all the log files/temporary files created as part of the scripting process
What can be lost due to faulty loops?
Network or memory resources
What could cause the file explorer or command interpreter to crash?
Incorrect API calls