1 #tar xz targzs to destination
5 while read targz_file
; do
6 tar xzf
"$targz_file" -C "$DIR_DST" 2> /dev
/null
8 #2 return code (value) (error) eg.: overwriting an existing directory with symbolic link
9 if [ "$retval" = 2 ]; then
10 tar tzf
"$targz_file" |
grep -v "/$" | \
12 #[ -d "$DIR_DST"/"$file" -a ! -L "$DIR_DST"/"$file" ] && echo "$file"
13 [ -d "$DIR_DST"/"$file" -a ! -L "$DIR_DST"/"$file" ] && rm -rf "$DIR_DST"/"$file"
15 tar xzf
"$targz_file" -C "$DIR_DST" 2> /dev
/null
22 [ ! -f "$TGZ" ] && echo "No such targz file" && exit 1
29 [ ! -d "$DIR_SRC" ] && echo "No such source directory" && exit 1
30 [ ! -d "$DIR_DST" ] && echo "No such destination directory" && exit 1
32 DIR_DST
=`cd "$DIR_DST" && pwd -P`
33 [ "$?" != 0 ] && echo "Cannot change to destination directory" && exit 1
36 [ "$?" != 0 ] && echo "Cannot change to source directory" && exit 1
38 if [ -n "$TGZ" ]; then
41 ls *.
tar.gz
2> /dev
/null | untargz