Understanding Unix spells and curses
Oct 9, 2008 — by Eric Brown — from the LinuxDevices Archive — 5 viewsIBM's DeveloperWorks has published a tutorial on Unix pipelines, redirections, operators, and other “strange characters” inhabiting Unix's command line netherworld. “Speaking UNIX: !$#@*%” aims to teach intermediate Unix and Linux users a better understanding of the symbols used by system administrators in both interactive and non-interactive shell programming.
The tutorial is designed for users who have “learned a few of the basic commands to help maneuver through a directory structure, create and modify files, see what processes are running, and maybe even administer users and the system,” says Cormany, who is National Data Center Manager at Scientific Games Corp. The tutorial uses the ksh (Korn shell), but most of it also applies to bash, the default Linux shell.
Cormany starts off by explaining the pipeline, or pipe, which “is an integral part of everyday processing,” he writes. Most often, pipelines are used to enable developers to redirect the standard output (stdout) of one command to become the standard input (stdin) of the subsequent command, he explains.
Next, Cormany covers single and double less-than and greater-than signs, which can be used to put data into and out of files. Other topics and coding examples address:
- Subshells — for executing several commands together
- Test command — used for evaluating expressions or values
- Test operators — for error and status checking
- Logical operators — for definitive conditional evaluations of expressions or their values (good for streamlining code)
- Comparison test operators — more error and status checking, but used primarily with strings and numeric values
- Substitution operators — for defining variables or assigning values
Availability
The full IBM DeveloperWorks tutorial, “Speaking UNIX: !$#@*%,” should be available here.
This article was originally published on LinuxDevices.com 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.