Created
July 11, 2014 08:11
-
-
Save arne-cl/088df47e3f1624d008b3 to your computer and use it in GitHub Desktop.
dowload a compressed file, unpack it, cd into the directory and list its content
This file contains 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
#!/usr/bin/env bash | |
url="$1" | |
wget -q "$url" | |
tarfile=${url##*/} # strip off the part before the last slash | |
dtrx "$tarfile" | |
dir=${tarfile%%.*} # strip off everything after the first dot | |
cd "$dir" | |
ls | |
# TODO: stay in $dir after the script ends | |
# TODO: handle dtrx interaction |
dtrx was written in Python, so we could turn this into a proper script!
http://brettcsmith.org/2007/dtrx/
hg clone http://www.brettcsmith.org/2007/dtrx/dtrx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems, bash can't change a directory from within a script (b/c scripts are run in a subshell):