2IMPROVING ON USER COMMANDS
A typical Unix or Linux system includes hundreds of commands by default, which, when you factor in flags and the possible ways to combine commands with pipes, produces millions of different ways to work on the command line.
Before we go any further, Listing 2-1 shows a bonus script that will tell you how many commands are in your PATH.
#!/bin/bash # How many commands: a simple script to count how many executable # commands are in your current PATH IFS=":" count=0 ; nonex=0 for directory in $PATH ; do if [ -d "$directory" ] ; then for command in "$directory"/* ; do if [ -x "$command" ] ; then count="$(( $count + 1 ))" ...
Get Wicked Cool Shell Scripts, 2nd 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.