Hey all,

Im creating a shell script that has an option to take a file to write the output into instead of displaying it on the terminal (stdout)...and then takes an arbitrary number of input files to process.

Usage is something like this:
$command [-option outputFile] inputFiles....

If the option command is not given...the output is displayed on the screen..

I tried usign a case statement, like this:

case $1 in
      -i) shift ;;
      *) set -- /dev/stdout ;;
esac

But didnot work, because when I use the shift command, I lose one input file :(

Any help is appreciated.
Regards :)

So with the option:

$command [-option outputFile] inputFiles....

Default case:

$command inputFiles....
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.