19 lines
229 B
Bash
Executable file
19 lines
229 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
trap "rm -f /tmp/xx$$" 0 1 2 3 15
|
|
case $2 in
|
|
/*) target_dir=$2
|
|
;;
|
|
*) target_dir=`pwd`/$2
|
|
;;
|
|
esac
|
|
cd $1
|
|
tar cf /tmp/xx$$ .
|
|
if [ -d $target_dir ]
|
|
then :
|
|
else mkdir $target_dir
|
|
fi
|
|
cd $target_dir
|
|
tar xf /tmp/xx$$
|