#!/bin/sh files=$1 # Make target file empty cat /dev/null > $2 # Attach each file from the specified mask to the target file for file in $files do # Process a file only if it exists if [ -e $file ] then # Append content of the current file to the target file cat $file >> $2 fi done