Difference between revisions of "Scripting"

From eLinux.org
Jump to: navigation, search
(Historical)
(Historical)
(12 intermediate revisions by the same user not shown)
Line 14: Line 14:
  
 
===Shell scripting libraries===
 
===Shell scripting libraries===
 
+
* [http://www.gnu.org/software/shtool/ shtool] The GNU Portable Shell Tool
 +
** Portable wrappers to standard operations
 +
** 3000 SLOC, 19 functions, bloated
 +
* [http://intuitive.com/wicked/wicked-cool-shell-script-library.shtml 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
 
* [http://marcomaggi.github.io/docs/mbfl.html mbfl - Marco's Bash Functions Library]
 
* [http://marcomaggi.github.io/docs/mbfl.html mbfl - Marco's Bash Functions Library]
 
** 5000 SLOC, 500 functions, bloated
 
** 5000 SLOC, 500 functions, bloated
 
** The philosophy of MBFL is to do the work as much as possible without external commands.
 
** The philosophy of MBFL is to do the work as much as possible without external commands.
** Сomplicated to use
+
** Complicated to use
 +
* [https://github.com/lmartinking/monkey-tail @ aka monkey-tail]
 +
** 300 SLOC, 20 functions, simple wrapper functions
 +
** Easy to use
 +
* [https://github.com/makelinux/lib lib.sh]
 +
** Single script, 300 SLOC, 40 functions and aliases
 +
** Easy to use
 +
** Most useful functions: readline-bindings, duplicates, fs_usage, system_status_short, git_fixup, tcpdump-text, git_ign_add, for_each, mem_avail_kb
 +
====Specialized frameworks and libraries====
 
* [http://www.bashinator.org/ Bashinator]
 
* [http://www.bashinator.org/ Bashinator]
 
** Logging framework
 
** Logging framework
 
** 700 SLOC, 18 functions
 
** 700 SLOC, 18 functions
** Сomplicated to use
+
** Complicated to use
 +
* [http://sourceforge.net/projects/libbash/ libbash - tool for managing bash scripts]
 +
** loads and unloads functions from scripts with commands source and unset
 
* [http://code.google.com/p/bsfl/ bsfl - Bash Shell Function Library ]
 
* [http://code.google.com/p/bsfl/ bsfl - Bash Shell Function Library ]
 
** 600 SLOC, 50 functions, logging functions, trivial wrappers
 
** 600 SLOC, 50 functions, logging functions, trivial wrappers
Line 32: Line 49:
 
* [https://sites.google.com/a/forestent.com/projects/log4sh log4sh - logging framework]
 
* [https://sites.google.com/a/forestent.com/projects/log4sh log4sh - logging framework]
 
** logging framework for shell scripts that works similar to http://logging.apache.org/
 
** logging framework for shell scripts that works similar to http://logging.apache.org/
* [http://sourceforge.net/projects/libbash/ libbash - tool for managing bash scripts]
+
* [https://github.com/jpic/bashworks bashworks] - something messy
** loads and unloads functions from scripts with commands source and unset
 
* [https://github.com/jpic/bashworks bashworks]
 
 
* [https://github.com/rerun/rerun/blob/master/README.md rerun - a modular shell automation framework to organize your keeper scripts]
 
* [https://github.com/rerun/rerun/blob/master/README.md rerun - a modular shell automation framework to organize your keeper scripts]
 
** 700 SLOC, 30 functions
 
** 700 SLOC, 30 functions
* [https://github.com/lmartinking/monkey-tail @ aka monkey-tail]
+
 
** 300 SLOC, 20 functions, simple wrapper functions
 
** Easy to use
 
 
====Samples from books====
 
====Samples from books====
 
* [http://examples.oreilly.com/9781565923478/ Learning the bash shell, 2005, samples], 62 files
 
* [http://examples.oreilly.com/9781565923478/ Learning the bash shell, 2005, samples], 62 files
Line 49: Line 62:
 
* [http://www.cs.uleth.ca/~holzmann/C/shells/shell_book_blinn/ Portable Shell Programming, 1995, samples]
 
* [http://www.cs.uleth.ca/~holzmann/C/shells/shell_book_blinn/ Portable Shell Programming, 1995, samples]
 
** 1000 SLOC, 33 files-functions
 
** 1000 SLOC, 33 files-functions
* [http://intuitive.com/wicked/wicked-cool-shell-script-library.shtml Wicked Cool Shell Scripts, 2004, samples]
+
** Usually operations implelented in sheel. Usedfull on out of memory (OOM) when there is no memory to run external programms.
** 4000 SLOC, 100 files-functions
+
** easy to use
** Easy to use
 
  
 
====References====
 
====References====

Revision as of 04:19, 19 January 2014

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
    • Portable wrappers to standard operations
    • 3000 SLOC, 19 functions, bloated
  • 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: 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