Difference between revisions of "Scripting"

From eLinux.org
Jump to: navigation, search
(Fix GNU-Linux-Tools-Summary)
(wicked_cool_shell_scripts_2e)
 
(3 intermediate revisions by 2 users not shown)
Line 13: Line 13:
 
* https://wiki.archlinux.org/index.php/bash
 
* https://wiki.archlinux.org/index.php/bash
 
* http://www.techbar.me/linux-shell-tips/
 
* http://www.techbar.me/linux-shell-tips/
 +
* https://natelandau.com/bash-scripting-utilities/
  
 
===Shell scripting libraries===
 
===Shell scripting libraries===
Line 19: Line 20:
 
** Portable wrappers to standard operations
 
** Portable wrappers to standard operations
 
** 3000 SLOC, 19 functions, bloated
 
** 3000 SLOC, 19 functions, bloated
* [http://intuitive.com/wicked/wicked-cool-shell-script-library.shtml Wicked Cool Shell Scripts, 2004, samples]
+
* [https://github.com/brandonprry/wicked_cool_shell_scripts_2e Wicked Cool Shell Scripts 2e] <small>[http://intuitive.com/wicked/wicked-cool-shell-script-library.shtml Wicked Cool Shell Scripts, 2004, samples]</small>
 
** Indeed cool shell scripts, worth to read
 
** Indeed cool shell scripts, worth to read
 
** Most in interesting functions: 015-newrm.sh, 016-unrm.sh, 021-findman.sh, 029-loancalc.sh, 037-zcat.sh, 038-bestcompress.sh, 040-diskhogs.sh, 084-webaccess.sh, 100-hangman.sh
 
** Most in interesting functions: 015-newrm.sh, 016-unrm.sh, 021-findman.sh, 029-loancalc.sh, 037-zcat.sh, 038-bestcompress.sh, 040-diskhogs.sh, 084-webaccess.sh, 100-hangman.sh
Line 42: Line 43:
 
* [http://sourceforge.net/projects/libbash/ libbash - tool for managing bash scripts]
 
* [http://sourceforge.net/projects/libbash/ libbash - tool for managing bash scripts]
 
** loads and unloads functions from scripts with commands source and unset
 
** loads and unloads functions from scripts with commands source and unset
* [http://code.google.com/p/bsfl/ bsfl - Bash Shell Function Library ]
+
* [https://github.com/SkypLabs/bsfl bsfl - Bash Shell Function Library]
 
** 600 SLOC, 50 functions, logging functions, trivial wrappers
 
** 600 SLOC, 50 functions, logging functions, trivial wrappers
 
** Easy to use
 
** Easy to use
 
* [http://code.google.com/p/shesfw/ shesfw - Shell Script Framework tool]
 
* [http://code.google.com/p/shesfw/ shesfw - Shell Script Framework tool]
 +
** exported to [https://github.com/kennelbound/shesfw GitHhub]
 
** 200 SLOC, 20 functions
 
** 200 SLOC, 20 functions
 
** unified interface to kdialog, Xdialog, zenity
 
** unified interface to kdialog, Xdialog, zenity

Latest revision as of 23:47, 24 June 2019

Scripting is powerful technology especially valuable in embbedded Linux. It is used for building complex projects, building root file systems and distributions, system management, tests automation.

Most commons shells are bash on PC and busybox's ash on embedded Linux.

Shell scripting

Shell scripting libraries

  • shtool The GNU Portable Shell Tool
    • man shtool
    • Portable wrappers to standard operations
    • 3000 SLOC, 19 functions, bloated
  • Wicked Cool Shell Scripts 2e Wicked Cool Shell Scripts, 2004, samples
    • Indeed cool shell scripts, worth to read
    • Most in interesting functions: 015-newrm.sh, 016-unrm.sh, 021-findman.sh, 029-loancalc.sh, 037-zcat.sh, 038-bestcompress.sh, 040-diskhogs.sh, 084-webaccess.sh, 100-hangman.sh
    • 4000 SLOC, 100 files-functions
    • Easy to use
  • mbfl - Marco's Bash Functions Library
    • 5000 SLOC, 500 functions, bloated
    • The philosophy of MBFL is to do the work as much as possible without external commands.
    • Complicated to use
  • @ aka monkey-tail
    • 300 SLOC, 20 functions, simple wrapper functions
    • Easy to use
  • lib.sh
    • Single script, 300 SLOC, 40 functions and aliases
    • Easy to use
    • Most useful functions: make-debug, trap_err, readline-bindings, duplicates, fs_usage, system_status_short, git_fixup, tcpdump-text, git_ign_add, for_each, mem_avail_kb

Specialized frameworks and libraries

Samples from books

Historical

References

See also