Hi I have a lab header called header.txt and I want to cat into my 3 C files
cat ../header.txt > find -name *.c
What is wrong with the above statement?>
Output redirection is for files, not commands. You'll need to process each file separately.
find -name *.c -print0 | while IFS= read -r -d '' f; do
cat ../header.txt >> $f # Append instead of overwriting
done
As for the 'ambiguous redirect', you normally get that when you write something like:
... > *.c
and the glob *.c expands to more than one file. For example:
$ echo "" >> *.c
-sh: *.c: ambiguous redirect
$