LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-09-2008, 02:07 PM   #1
webaccounts
Member
 
Registered: May 2008
Location: Columbus Ohio
Distribution: CentOS 5.9/6.4 x64
Posts: 44

Rep: Reputation: 19
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.
 
Old 06-09-2008, 02:40 PM   #2
webaccounts
Member
 
Registered: May 2008
Location: Columbus Ohio
Distribution: CentOS 5.9/6.4 x64
Posts: 44

Original Poster
Rep: Reputation: 19
Nevermind. I got it to work.

The word group needed to be called from the echo.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing variable from bash to perl in a bash script quadmore Programming 6 02-21-2011 04:11 AM
Execute bash script inside PHP creatorrr Programming 11 11-21-2007 04:32 PM
How to acess Variable defined in perl script inside an awk call sumin Programming 3 04-26-2007 05:19 AM
Variable expansion inside of a bash script! A.S.Q. Linux - Newbie 4 09-29-2006 09:09 AM
how do i kill a process from inside a bash script? mikaelo Programming 4 05-28-2004 08:51 AM


All times are GMT -5. The time now is 01:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration