8 output
="$prefix-$name.tar.gz"
10 # Set up the temporary directory
12 dir
="$tempdir/$prefix"
17 # Copy the files specified in the remaining arguments to the temporary dir
18 cp --parents -l $
* $dir
20 # Create the actual archive
21 if [ -f "$output" ]; then
22 if [ "$mode" = "--create" ]; then
26 tar -C $tempdir -xzf $pwd/$output 2>/dev
/null
29 tar -C $tempdir -czf $pwd/$output $prefix 2>/dev
/null
31 # Print a message about the number of files that were added to the archive
32 printf '%-40s%4d extra %4d total\n' \
33 $output ${#*} $
(find $tempdir -type f |
wc -w)
35 # Remove temporary directory
36 if [ -n "$(echo $tempdir | grep ^/tmp)" ]; then
39 echo Error
: temporary directory not
in /tmp
: $tempdir