I'm very much a newbie and hence why this is going to be a stupid question.
I'm attempting to create a korn shell script that pulls zone file locations and includes the copy command in the output. What?
getzonedir.ksh
#!/bin/ksh
while read -r domain
do ls */*"$domain" > $dir1
echo "cp $dir1 $dir1-$2"
done < $1
$1 = user1domains.txt
hosangit.com
djzah.com
ourholychurch.com
$2 = usr1bak
RUN: ./getzonedir.ksh user1domains.txt usr1bak
Expected output...
first step would be the domain zone files are found, so stepping through the first it would find primary.dir/db.hosangit.com (this I want to become a variable so I can echo the command needed to backup this zone file for example "cp primary.dir/db.hosangit.com primary.dir/db.hosangit.com-usr1bak
I know this doesn't answer your question exactly, but I think it should help you get to where you are going. There are other ways to achieve the same thing without using 'find' as well.
I use ls */*$domain <--which is fed from the .txt file for the domains I'm interested in and it works great so far but I want to output the results (which would be the full path and zone file name) into a variable. I thought you could output the results using a > to variable name but that doesn't seem to work. If I could get the entire path and file name into a variable then I could either print the variable with the commands I want like
I'm guessing he is just trying to output what would be happening, before he turns it loose. Just guessing, I tend to do the same when trying something new.
Thank You for the input. Its just like Blackacid said, I like seeing what should happen before I let it loose. Its my lack of confidence during my learning how to script.