[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: script help



Bob Alexander wrote:
I keep a few different kernel source trees under /usr/src and each of them has a different .config file.

Part of my pre-backup script I would like to run a command such as

find /usr/src -name .config

for example:

/usr/src/kernel-source-2.6.9-rja/.config
/usr/src/linux-2.6.10-rja/.config

and for every match write a file to my /backup_data directory with a filename that is made up like "kernel-source-2.6.9-rja.config" and "linux-2.6.10-rja.config" or some similar unique filename which relates the the kernel tree.

Thank you for any help,
Bob



(using bash:)
for i in *
do
  if [ -d $i ]
  then
    if [ -f $i/.config ]
      then
      echo cp $i/.config /backup_data/$i.config
    fi
  fi
done

If this prints the correct lines, remove echo in front of the cp and run again ;)

HTH,

Joris



Reply to: