Bootstrap FreeKB Articles

Bash (Scripting) articles


Command Line Options and Flags Command line options flags arguments (case statement) shift command line options Commands Running commands in a bash shell script cron Create a crontab entry in bash script Dictionaries Getting Started with Dictionaries Duplicates Remove duplicate lines in a file Email Send a daily email (cron) Files Create Excel or CSV file Functions Getting Started with functions Returning values from a function if elif else then if, elif, else, then statements IFS (Internal Field Separator) IFS (Internal Field Separator) Install Install an older version of Bash from source JSON Parse JSON (python) Lists Append values to a list (+=) Combining lists Convert string to list Count values in a list Get the first element from a List Get the last element from a List Getting Started with Lists Remove values from a list Removing duplicate values from a list Replace value in a list Sorting Lists loading bar How to show loading bar in Bash shell script Loops for loops Move onto next value in a loop (continue) select loops while loops Math Addition and Increment (+) Division Multiplication Subtraction None Run a BASH script as root Printing printing bold text Regular Expressions Add a leading zero to single digit numbers in Linux append new lines to a file or variable carriage returns (\r ^M) do something empty lines (sed) do something every nth match do something every other match do something first all or last match do something forward slashes do something match does/doesn't begin with pattern do something match does/doesn't end with pattern do something pattern match do something range match grep previous or next match inline text (paste command) new lines \n and carriage returns \r replace string in file Replacing whitespace uppercase or lowercase (tr command) wildcard character Script interpreter Understanding script interpreter scriptname scriptname $0 SSH Getting Started with SSH Troubleshooting Resolve "root: command not found" Resolve "unary operator expected" Resolve /bin/bash^M: bad interpreter: No such file or directory Variables append values to a variable (+=) join lines in a variable join lines in different variables local and remote variables with SSH remove duplicate values from a variable remove new lines from a variable replace values in a variable