Module 11: Basic scripting Flashcards
(56 cards)
What is a shell script?
A file of executable commands that has been stored in a text file
Which text editor is used? What command?
Nano
Command: nano with script name
Nano test.sh
How to write a script?
Nano command
To get into the text editor
How to write a script inside text editor
Start with #! /bin/sh or bash
And then write the commands you want the script to do
How to search the document
Control and W
What are variables?
Holds temporary information in the script
What are conditionals?
It lets you do different things based on tests you write
What are loops
Let’s you do the same thing over and over
How to assign a variables
VARIABLE NAME = “value”
No spaces in between
To include the name, it should precede a $ sign
What is the read command?
Can accept a string right from the keyboard or as part of command redirection
How to create a new file with vi editor?
Vi filename
When I you create a new file, what should you type to go in insert mode?
i
How to exit insert mode and quit?
Esc key
Type :wq to write file and quit
Which key moves line up and down in command mode?
J goes down and k goes up
Which command moves right and left when in command mode
L moves right and h moves left
Which command moves cursor to the beginning and end of word
W moves to the beginning of word and e moves to the end of word
Which command moves cursor to beginning of previous word?
B
How to delete a word
Using the dw command
How to undo a last operation
Using the u command
How to delete two words?
2dw
How to delete characters at a time
Using x
Example: xxxx
How to undo last four operations
4u
How to delete 14 characters
14x
How to delete characters from the left
Capital X
Ex:
5X