1/30
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
echo
it is the Bash Shell output mechanism:
echo
prints arguments to standard output separated by spaces
Prints the text you give it, then moves the cursor to the next line.
echo -n argument
no trailing newline after output
Prints the text but keeps the cursor on the same line. It Negates the automatic newline.
echo -e argument
interpret \char escapes
It tells echo to Enable the interpretation of special codes (called "escape sequences") that start with a backslash (\).
echo -E argument
do not interpret \char escapes
Explicitly tells echo to not interpret the escape sequences; it prints them Exactly as they are.
\a Alarm
ring the terminal bell
\b
Backspace
\c
print without trailing newline (same as print -n)
\f
Form feed
\n
Newline
\r
Return
\t
tab
\v
vertical tab
\\
Backslash
\xxx
Character with octal code (up to three octal digits)
read
To get input while a Shell Script is running
allows you to prompt for input and store it in a variable.
shell script or shell program
Shell program interprets user commands, which are either directly entered by the user, or which can be read from a file called
interpreted
Shell scripts are _______, not compiled
shell scripts
reads commands from the script line per line and searches for those commands on the system while a compiler converts a program into machine readable form, an executable file – which may then be used in a shell script.
#!/bin/bash
this an optional comment use to indicate will interpret by the bash shell.
echo
command displays the string, variables or arguments form the parameters.
sleep
command serves as a delay or pause for the next instructions or commands. [delay in seconds]
let argument
a built-in Shell command performs long integer arithmetic
let argument
approximately 10 times faster than expr
Evaluates each argument as an arithmetic expression
No quotes for special characters, or arguments with spaces or tabs
bc -
performs floating point arithmetic
acts as a filter command or interactively
reads arithmetic expression strings from standard input or specified file
semicolons or new lines separate expressions
set the scale variable inside bc to define the required number of decimal places
$
Variables need no
0 (True)
The command completed without errors.
1 (False)
The command encountered an error (e.g., file not found, bad permissions, wrong syntax, general error).
compiler
converts a program into a machine-readable, executable file.
user environment
main task of a shell is providing this, and it can be configured individually using shell resource configuration files.
bc -l
a shell script to compute a discount, which involves division and decimals
ensures that the bc
program is ready for precise floating-point math, handling the division correctly even if the numbers were more complex