extract.sh modified for bash