- Get link
- X
- Other Apps
Bash built-in commands GNU manual:
https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html
Built-in, Special built-in and POSIX Inherited command list:
https://www.computerhope.com/unix/bash/index.htm
Basic syntax and special characters
Character Description
# Used to add a comment, except when used as \#, or as #! when starting a script
\ Used at the end of a line to indicate continuation on to the next line
; Used to interpret what follows as a new command to be executed next
$ Indicates what follows is an environment variable
> Redirect output
>> Append output
< Redirect input
| Used to pipe the result into the next command
Parameters
Command substitution
Variables
To export the variable in order to be valid also for the child processes:
export VAR=value
or
VAR=value ; export VAR
where "VAR" is the variable we want to export.
When a child process modifies a variable, that remains within the child processes and it doesn't affect the variable of the parent process. In other words, exporting means copying and inheriting.
Functions
Entering a function in a script means:
- Declaring a function
- Calling a function
The function declaration requires a name which is used to invoke it. The proper syntax is:
function_name () {
command...
}
Comments
Post a Comment