Question : shell script - detect folder name from tar extraction

im trying to write a shell script to automatically download some software and install it.

heres what i have:

#!/bin/bash
clear
wget http://www.somesite.com/downloads/software-current.tar.gz
tar -xvzf software-current.tar.gz
cd software-2.5-3/
./setup
cd ..
rm -fR software-2.5-3/

the problem is the version changes on the folder so my script could become outdated quickly and not be able to open the correct drectory.

2 questions:
1) Is there a way to detect the directory name that tar creates?
2) Is there a way to send TAB to the screen to complete the path like:
cd software-TABKEY ->so screen would autocomplete the path...

Answer : shell script - detect folder name from tar extraction

1) DIR=$( tar -tzf software-current.tar.gz | head -1 )
cd $DIR

2) AFAIK no not possible

Random Solutions  
 
programming4us programming4us