The following post will guide you through the secrets behind BASH and allow you to get the maximum from this shell.
Complete – command line to load command completion with tab.
Complete –p : shows all custom completion
Compgen – gets list of values with prefix for each and gets the user input and completes all started with this phrase.
Compgen –W “—param1 –param2 …” – “—paramx”
This command working by itself.
Complete –F _function command
multiple conditions on bash – [[ condition1 && condition2 ]].
About arrays: http://tldp.org/LDP/abs/html/arrays.html
List to array:
Find the highest number: http://stackoverflow.com/questions/12744245/bash-how-to-find-the-highest-number-in-array
For loop from start to end: http://stackoverflow.com/questions/6191146/variables-in-bash-seq-replacement-1-10
Shell variables are variables only reachable at the current shell. No child will be able to read this variable.
Those variables are reachable both at the current shell and in the subsequent shells.
Export –n <varname> – will turn environment variable into shell variable
Unset <varname> – delete the variable
|Ctrl + A||Go to the beginning of the line you are currently typing on|
|Ctrl + E||Go to the end of the line you are currently typing on|
|Ctrl + L||Clears the Screen, similar to the clear command|
|Ctrl + U||Clears the line before the cursor position. If you are at the end of the line, clears the entire line.|
|Ctrl + H||Same as backspace|
|Ctrl + R||Let’s you search through previously used commands|
|Ctrl + C||Kill whatever you are running|
|Ctrl + D||Exit the current shell|
|Ctrl + Z||Puts whatever you are running into a suspended background process. fg restores it.|
|Ctrl + W||Delete the word before the cursor|
|Alt + D||Delete the word after the cursor|
|Ctrl + K||Clear the line after the cursor|
|Ctrl + T||Swap the last two characters before the cursor|
|Esc + T||Swap the last two words before the cursor|
|Alt + F||Move cursor forward one word on the current line|
|Alt + B||Move cursor backward one word on the current line|
|Tab||Auto-complete files and folder names|