====== UNIX Shell Scripting with BASH ====== ===== Manuals ===== * [[http://www.gnu.org/software/bash/manual/bash.html|Bash Reference Manual]] * [[http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html|Bash Guide for Beginners]] * [[http://tldp.org/LDP/abs/html/|Advanced Bash-Scripting Guide]] -- An in-depth exploration of the art of shell scripting * [[http://www.grymoire.com/Unix/Sh.html|Bourne Shell]] -- Everything you wanted to know. * [[http://cfaj.freeshell.org/shell/|Unix Shell Scripting by Chris Johnson]] -- A quick Reference * [[http://marmaro.de/docs/freiesmagazin/shebang/shebang.txt|Shebang - All der Kram]] :DE: * [[http://wiki.ubuntuusers.de/Shell/Bash-Skripting-Guide_f%C3%BCr_Anf%C3%A4nger|Bash-Skripting-Guide für Anfänger]] :DE: -- [[http://wiki.ubuntuusers.de|wiki.ubuntuusers.de]] => see also [[http://wiki.ubuntuusers.de/Shell/Tipps_und_Tricks|Tipps und Tricks]] * [[http://mywiki.wooledge.org/BashPitfalls|Bash Pitfalls]] * [[http://wiki.bash-hackers.org/start|The Bash Hackers Wiki]] * [[http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/|The Definitive Guide to Bash Command Line History]] ==== Quick Reference ==== * {{ http://www.catonmat.net/download/bash-redirections-cheat-sheet.pdf|Bash Redirections Cheat Sheet }} * {{ http://www.catonmat.net/download/bash-history-cheat-sheet.pdf|Bash History Cheat Sheet }} * [[http://ascii-table.com/ansi-escape-sequences-vt-100.php|ANSI Escape sequences - VT100 / VT52 (ANSI Escape codes)]] ===== Frequently Asked Questions ===== * [[https://stackoverflow.com/questions/2596462/how-to-strip-leading-in-unix-find|How to strip leading “./” in unix “find”?]] * [[http://www.pixelbeat.org/cmdline.html|Linux Command Line Tips]] -- One Liners * [[http://www.pixelbeat.org/scripts/|A compilation of scripts]] * [[http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html|Howto Make Script More Portable With #!/usr/bin/env As a Shebang]] * http://wiki.ubuntuusers.de/Alias * [[http://stackoverflow.com/questions/36109/quoting-command-line-arguments-in-shell-scripts|Quoting command-line arguments in shell scripts]] * [[http://nixcraft.com/getting-started-tutorials/12174-linux-unix-adding-directory-your-path.html|Adding a directory to your path]] * [[http://www.linuxconfig.org/Bash_scripting_Tutorial|Bash scripting Tutorial]] * Presenting Usage message: :TODO: * [[http://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs|Shell Scripting with KDE Dialogs]] * [[https://stackoverflow.com/questions/1654021/how-can-i-delete-a-newline-if-it-is-the-last-character-in-a-file|How can I delete a newline if it is the last character in a file?]] * [[https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux|How to change the output color of echo in Linux]] ===== Examples & Solutions ===== * [[Image Processing]] * [[Script arguments]] * [[prompt]] ==== Tests ==== * [[http://wiki.bash-hackers.org/commands/classictest|The classic test command]] * [[https://stackoverflow.com/questions/2210349/bash-test-whether-string-is-valid-as-an-integer|BASH: Test whether string is valid as an integer?]] * [[https://stackoverflow.com/questions/229551/string-contains-in-bash|Test whether string contains pattern in Bash]] * [[https://stackoverflow.com/questions/21425006/bash-how-to-check-if-the-last-string-character-equals|How to check if the last string character equals '*']] ==== Variables ==== * [[http://tldp.org/LDP/abs/html/refcards.html#AEN22728|Variable operations]] explained. * [[http://tldp.org/LDP/abs/html/string-manipulation.html|Manipulating Strings]] with examples. * [[https://stackoverflow.com/questions/22401091/bash-variable-substitution-vs-dirname-and-basename|Bash variable substitution vs dirname and basename]] * [[https://stackoverflow.com/questions/307503/whats-a-concise-way-to-check-that-environment-variables-are-set-in-a-unix-shell|What's a concise way to check that environment variables are set in a Unix shell script?]] * [[https://stackoverflow.com/questions/26887108/default-value-of-variable-in-bash/26887195#26887195|Default value of variable in bash]] * [[https://stackoverflow.com/questions/370047/what-is-the-most-elegant-way-to-remove-a-path-from-the-path-variable-in-bash|What is the most elegant way to remove a path from the $PATH variable in Bash?]] ==== Arrays ==== * [[https://www.thegeekstuff.com/2010/06/bash-array-tutorial/|The Ultimate Bash Array Tutorial with 15 Examples]] ==== Loops ==== * [[https://stackoverflow.com/questions/169511/how-do-i-iterate-over-a-range-of-numbers-defined-by-variables-in-bash|How do I iterate over a range of numbers defined by variables in Bash?]] ==== Arithmetics ==== *[[https://ryanstutorials.net/bash-scripting-tutorial/bash-arithmetic.php|Arithmetic in Bash scripting]] ==== Files & Folders ==== * [[https://unix.stackexchange.com/questions/8430/how-to-remove-all-empty-directories-in-a-subtree|How to remove all empty directories in a subtree?]] * [[http://stackoverflow.com/questions/4817313/bash-script-to-delete-all-but-n-files-when-sorted-alphabetically|Bash script to delete all but N files when sorted alphabetically]] * [[http://www.commandlinefu.com/commands/view/5238/recursively-change-file-name-from-uppercase-to-lowercase-or-viceversa|recursively change file name from uppercase to lowercase (or viceversa)]] * [[https://stackoverflow.com/questions/152514/how-to-rename-all-folders-and-files-to-lowercase-on-linux|How to rename all folders and files to lowercase on Linux?]] * [[https://unix.stackexchange.com/questions/239243/bash-poll-for-a-file-creation-and-terminate-if-exits|Poll for a file creation and terminate if exits]]\\ => https://wiki.ubuntuusers.de/inotify/ ==== Shell Setup ==== * [[..:profile]] * [[..:bashrc]] * [[..:bash_aliases]] * [[http://www.alias.sh/featured-aliases|www.alias.sh]] -- Use Alias.sh to synchronise your aliases across all machines. ==== Parser ==== * [[http://heinitz-it.de/archives/64|INI-FIle Parser als Einzeiler in Bash]] ===== Tips and Tricks ===== * [[http://ciembor.github.io/4bit/|4bit Terminal Color Scheme Designer]] * [[http://teaching.idallen.com/cst8207/15f/notes/740_script_problems.html|Shell Script Problems – arithmetic, syntax, test, boolean, etc.]] ===== External Programs ===== * [[http://www.softpanorama.org/Tools/Find/index.shtml|Unix Find Tutorial]] [(https://web.archive.org/web/20180901030301/http://softpanorama.org/Tools/Find/index.shtml)] * [[..:sed]] -- The Unix Stream Editor. * [[..:banner]] -- create highly visible separator pages * https://sourceforge.net/projects/umlaute/ -- A short script to correct vowel mutation (Umlaut) errors in filenames. This errors typically occur when you copy files to a system with UTF-8 charset from a system using another charset.