This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read .swenv.(out|in) when changing the current directory | |
function swenv_out() { | |
predir=~1 | |
outfile="${predir}/.swenv.out" | |
[ -d "$predir" -a -e "$outfile" -a -O "$outfile" -a -w "$outfile" ] && source $outfile | |
} | |
function swenv_in() { | |
infile=".swenv.in" | |
[ -e $infile -a -O $infile -a -w $infile ] && source $infile | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -- | |
for F in $@ ; do | |
if [ `tar tf $F | grep -o '^[^/]*/' | sort | uniq | wc -l` -eq 1 ]; then | |
tar xvf $F | |
else | |
D=`basename \`basename \\\`basename \\\\\\\`basename \\\\\\\\\\\\\\\`basename \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`basename "$F" .tgz\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\` .tbz\\\\\\\\\\\\\\\` .txz\\\\\\\` .tar.gz\\\` .tar.bz2\` .tar.xz` | |
mkdir $D && tar xvf $F -C $D | |
fi | |
done |