LinuxDevices.com Archive Index (1999-2012) | 2013-current at LinuxGizmos.com | About  
Follow LinuxGizmos:
Twitter Google+ Facebook RSS feed

Tutorial explains “Shell Curses”

Mar 27, 2008 — by Eric Brown — from the LinuxDevices Archive
Share this: Tweet about this on TwitterGoogle+Share on FacebookShare on LinkedInShare on Reddit

IBM DeveloperWorks has published a tutorial on the “Shell Curses” library of cursor-manipulation script functions for shell programmers. Written by Dana French, the creator of Shell Curses back in 1993, this intermediate-level tutorial explains the library's terminal functions, and provides tips and code samples for writing typical scripts.

Much like the “C” language “Curses” library, Shell Curses enable programmers to perform text-based cursor movements to specific screen locations, says French. The library enables shell programmers to create menuing and data-entry systems without the need to use compiled binaries.

In recent years, says French, knowledge of Shell Curses has faded among UNIX administrators due to the improvements in graphical interfaces. Yet, “the need still exists for these functions,” he argues. For example, they are an efficient way to write Bash shell scripts that have menus and do input-entry validation or for creating front-ends for installation systems, databases, and other menuing programs. The syntax is similar to “C” Curses, says French, but Shell Curses offers the advantage of not requiring compilation.

In the tutorial, French describes each of the functions, as well as “enhanced” functions such as getwd (retrieve one word from standard input). He then provides code examples and offers tips such as how to overcome a common glitch when using Shell Curses with IBM AIX, and how to decide when to use a function library vs. including a file as a “dot” script.

The free text-based tutorial, “Shell Curses function library,” is available on IBM DeveloperWorks, here. A full list of shell curses functions can be found here.


 
This article was originally published on LinuxDevices and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.

(advertise here)


Comments are closed.