LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash Script Help - Trying to create a variable inside script when run. (http://www.linuxquestions.org/questions/linux-newbie-8/bash-script-help-trying-to-create-a-variable-inside-script-when-run-648089/)

webaccounts 06-09-2008 03:07 PM

Bash Script Help - Trying to create a variable inside script when run.
 
What I want to do is to get a list of folders under a directory and make each folder its own variable. Here is what I have so far.

Code:

# Get the list of folders.
count=0
varcount=0
cd $webroot
for i in */; do
basename=`basename "$i"`
let count=count+1
let varcount=varcount+1
varcount=$count
basename2="$basename2 $basename "
done
PS3="Pick 1 of the $varcount $group web folders?: "
select group in $basename2
do
break
done
echo $basename2
exit 1

$basename2 is the result with all the folders with spaces in between. I was hoping that I could pick a number and select that folder.

webaccounts 06-09-2008 03:40 PM

Nevermind. I got it to work.

The word group needed to be called from the echo.


All times are GMT -5. The time now is 08:05 AM.