Friday, October 14, 2011

Scatter Gather on linux

Hi,

I have been doing this many times but never blogged, its the scatter gather use to be on dbase days;

This program:
$ cat hello.sh
source e/big.conf

set `date` && export WeekDay=$1 Month=$2 Day=$3 Time=$4 Year=$6

echo Hello $NAME
echo $NO
echo Time: $Time
echo Date: $WeekDay $Month $Day $Year



$ sh hello.sh
Hello SmaLl
2000
Time: 11:24:29
Date: Fri Oct 14 2011


In hello.sh, i am calling the name/value pairs file,
$ cat e/big.conf
NAME=SmaLl
NO=2000

Exporting the date o/p to the positional parameters, hey did it in college days.
set `date` && export WeekDay=$1 Month=$2 Day=$3 Time=$4 Year=$6

Here we can have large name value pairs from static file or runtime command and play with it.