Date: 09/25/07 (Code WTF) Keywords: no keywords #!/bin/bash ... outputfile=".cpout" SourceFiles=`find . -name "*.hpp" -o -name "*.cpp" -o -name "*.c" -o -name "*.h"` IncludedFiles=`grep ^#include ${SourceFiles} | cut -f2- -d: | cut -f2- -d" " | grep -v "/\*\*/" | cut -f2 -d\" | cut -f1 -d\> | cut -f2- -d\< | sed "s/.*\///"|sort | sort -um` Subdirs=`ls -p | grep /` for Subdir in $Subdirs do mkdir -p ${INCLUDE_DIR}/$Subdir for File in $IncludedFiles do cp -p $Subdir/$File ${INCLUDE_DIR}/$Subdir >& $outputfile done done rm -f $outputfile ... (флаг -e aka exit-on-error не установлен) Source: http://community.livejournal.com/code_wtf/105061.html
|