#!/bin/sh # Shell script version of the 'y' unix executable. # Used for defaulting one value to all inputs of another program. # Usage: y [-l] [text] # With no text or -l, output defaults to 'y'. # Without -l, Only the first letter of text is output. # With -l, without text, output defaults to 'yes'. if [ "$1" = "-l" ]; then LONG=1 shift fi TEXT=$1 if [ "$TEXT" = "" ]; then TEXT=yes fi if [ "$LONG" = "1" ]; then : else TEXT=`echo $TEXT | awk '{print substr($1,1,1)}'` fi while : ; do echo $TEXT done