Appendix D. Shell Function Library
This appendix contains the complete shell function library from Chapter 21, “Problem Solving with Functions.” The library can be downloaded using the following URL:
http://www.csua.berkeley.edu/~ranga/downloads/tysp2/libtysp2.sh
Listing D.1. Listing of the Library libTYSP2.sh
# Name: printError # Desc: prints an message to STDERR # Args: $@ -> message to print printError () { echo "ERROR: $@" 1>&2 } # Name: printWarning # Desc: prints an message to STDERR # Args: $@ -> message to print printWarning () { echo "WARNING: $@" 1>&2 } # Name: promptYESNO # Desc: Asks a yes/no question # Args: $1 -> The prompt # $2 -> The default answer (optional) # Globals: YESNO -> set to the users response y for yes, n for no ... |
Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.