FreeKB - Bash (Scripting) articles
Bash (Scripting) articles

ArraysGetting Started with ArraysAppend values to an array (+=)Count values in an arraysort arrayunique arrayCommand Line Options and FlagsCommand line options flags arguments (case statement)cronCreate a crontab entry in bash scriptEmailSend a daily email (cron)FilesCreate Excel or CSV fileFunctionsGetting Started with functionsif elif else thenif, elif, else, then statementsIFS (Internal Field Separator)IFS (Internal Field Separator)Loopsfor loopsMove onto next value in a loop (continue)select loopswhile loopsMathAdditionDivisionMultiplicationSubtractionPrintingprinting bold textRegular ExpressionsAdd a leading zero to single digit numbers in Linuxappend new lines to a file or variablecarriage returns (\r ^M)do something empty lines (sed)do something every nth matchdo something every other matchdo something forward slashesdo something last matchdo something match does/doesn't begin with patterndo something match does/doesn't end with patterndo something pattern matchdo something range matchgrep previous or next matchinline text (paste command)newlines \nreplace string in fileuppercase or lowercase (tr command)whitespace \swildcard characterScript interpreterUnderstanding script interpreterSSHGetting Started with SSHVariablesappend values to a variable (+=)join lines in a variablejoin lines in different variableslocal and remote variables with SSHremove duplicate values from a variableremove new lines from a variablereplace values in a variable