Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-09-2008, 03:07 PM   #1
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.

# Get the list of folders.
cd $webroot
for i in */; do
basename=`basename "$i"`
let count=count+1
let varcount=varcount+1
basename2="$basename2 $basename "
PS3="Pick 1 of the $varcount $group web folders?: "
select group in $basename2
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, 03:40 PM   #2
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.


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 05:11 AM
Execute bash script inside PHP creatorrr Programming 11 11-21-2007 05:32 PM
How to acess Variable defined in perl script inside an awk call sumin Programming 3 04-26-2007 06:19 AM
Variable expansion inside of a bash script! A.S.Q. Linux - Newbie 4 09-29-2006 10:09 AM
how do i kill a process from inside a bash script? mikaelo Programming 4 05-28-2004 09:51 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:17 AM.

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