I'm struggling with this task:
Write a script that takes as input a directory (path) name and a filename base (such as ".", "*.txt", etc). The script shall search the given directory tree, find all files matching the given filename, and bundle them into a single file. Executing the given file as a script should return the original files.
Can anyone help me?
First i tried to do the find part like this:
#!/bin/bash
filebase=$2
path=$1
find $path \( -name $base \)
Then i found this code for bundle, but I dont know how to combine them.
for i in $@; do
echo "echo unpacking file $i"
echo "cat > $i <<EOF"
cat $i
echo "EOF"
done