[mdlug] Finding something for a cat

Jeff Hanson jhansonxi at gmail.com
Mon Aug 16 21:16:25 EDT 2010


I'm trying to save some typing with some kickstart config files but I
can't get find to work with cat properly.

Directory structure is as follows:
/srv/tftpboot/kickstart/ubuntu/10.10/
/srv/tftpboot/kickstart/ubuntu/10.04/
/srv/tftpboot/kickstart/ubuntu/9.10/
/srv/tftpboot/kickstart/kubuntu/10.10/
/srv/tftpboot/kickstart/kubuntu/10.04/
/srv/tftpboot/kickstart/kubuntu/9.10/
/srv/tftpboot/kickstart/xubuntu/10.10/
/srv/tftpboot/kickstart/xubuntu/10.04/
/srv/tftpboot/kickstart/xubuntu/9.10/

Each has these files:
alternate-i386-desktop.cfg
alternate-amd64-desktop.cfg

I have a text file of "standard" packages I need added with each of
these configurations to form a "standard" configuration:
/srv/tftpboot/kickstart/always_added_packages.txt

The result is just standard-alternate-i386-desktop.cfg or
alternate-amd64-desktop.cfg

>From the kickstart directory:
find . -type d -execdir cat '{}/alternate-i386-desktop.cfg'
/srv/tftpboot/kickstart/always_added_packages.txt>{}/standard-alternate-i386-desktop.cfg'
\;

This results in "bash: {}/standard-alternate-i386-desktop.cfg: No such
file or directory" as if the redirect char is causing a problem with
find and it's not expanding the variable correctly.

This one:

find . -type d -execdir echo '{}/alternate-i386-desktop.cfg
/srv/tftpboot/kickstart/always_added_packages.txt>{}/standard-alternate-i386-desktop.cfg'
\; | xargs -0 cat

Results in a "No such file or directory" error from cat with what
looks like the correct arguments but they are taken as a huge single
argument.  I tried changing the IFS to \n\r but that didn't affect it.

Any ideas?



More information about the mdlug mailing list