Bash problem

Kevin Brown plug-discuss@lists.plug.phoenix.az.us
Sun, 02 Feb 2003 01:37:54 -0700


> I have a large text file with a bunch of names in it.
> 
> Is there an easy way to have a script grep each name out of the file and do 
> something with it?
> 
> Like create a variable from each name with the name as the value?
> Or check to make sure that name is a folder somewhere else?

something like:

for p in `cat file`
do
echo $p
done

(add dir checking in place of echo $p).

for p in `cat file`
do
if [ ! -e "$p" ]
then
	`mkdir $p`
else
	if [ ! -d "$p" ]
		echo "Not a Directory, but file by $p name exists here"
	fi
fi


Or something similar.