Newsgroups: comp.unix.programmer
From: Barry Margolin <bar...@alum.mit.edu>
Date: Sat, 04 Jul 2009 02:23:18 -0400
Local: Sat 4 July 2009 07:23
Subject: Re: Writing a line based filter that exits when no input
In article <pan.2009.07.04.06.09...@tznvy.pbz>,
Anand Hariharan <znvygb.nanaq.unevun...@tznvy.pbz> wrote: > Am writing a line-based filter a la sed or tr. What I would like it to In the third case, there IS input -- standard input is connected to the > do, however, is if there is no input at start-up, it should present some > usage information and exit. > E.g., > $ MyLineFilter < TextFile # OK > $ Some Command | MyLineFilter # OK > $ MyLineFilter > $ echo $? > $ MyLineFilter Command Line Args # Undecided what to do here ... > Would appreciate some ideas on how to implement this. > Currently, am writing the usage information to stderr (unconditionally), terminal, and the user is supposed to type the input. If you don't want to take input from the terminal, you can use: if test -t -- You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||