bash: source - Initialize functions and/or aliases from a file.
-
Take into account the main readme for this section. README first.
The key command is called
source
. Description of the command is; execute commands from a file in the current shell.Create a file with functions and/or aliases. Only one function show here for demonstration purposes. In this example the file is called
checks
sys_check () { printf "\n\033[36m%s\\033[0m\n" "Basic system check" uptime printf "\n\033[36m%s\\033[0m\n" "When was the last boot" who -b }
Make function(s) accessible via the current shell session.
$ source checks
Now run your function from the current shell.
$ sys_check Basic system check 08:36:22 up 9 min, 1 user, load average: 0.06, 0.35, 0.33 When was the last boot system boot 2020-07-08 08:27
© Lightnetics 2024