1828186 Members
3380 Online
109975 Solutions
New Discussion

help on scripting

 
lawrenzo_1
Super Advisor

help on scripting

Below is a function within a script

for FILE in `find $CDCFG -name PROD"*"cfg -exec grep -il file {} \;`
do
cat $FILE > /tmp/$(basename $FILE).tmp
done

I want to list $FILE which contains 3 files and give the user an option to display the required file.

can anyone give me a few idea's.

cheers

hello
2 REPLIES 2
Biswajit Tripathy
Honored Contributor

Re: help on scripting

If I understand the question correctly, then try
this:

FILELIST=`find $CDCFG -name PROD"*"cfg -exec grep -il file {} \;`
echo "Enter the filename (options are $FILELIST)"
read FILE
cat $FILE > /tmp/basename $FILE.tmp

- Biswajit
:-)
lawrenzo_1
Super Advisor

Re: help on scripting

Thanks but not what i was looking for.

I want to list the files which are found then choose to cat the relevant file.

hello