[ale] Shell Scripting Question

Byron A Jeff byron at cc.gatech.edu
Wed Dec 10 14:57:54 EST 2003


On Wed, Dec 10, 2003 at 01:50:12PM -0500, Nick Travis wrote:
> Thanks, I didn't realize you didn't have to separate the variables.  It
> works perfectly now.

And if you are in a situation where you need to run a variable up against
some text that could be considered a variable name, then you can use braces
to separate the name. For example:

junk=testme
echo $junk123  # You want testme123 but you get nothing...

However

junk=testme
echo ${junk}123  # You want testme123 and you get testme123

BAJ

> 
> Nick
> 
> On Wed, 2003-12-10 at 13:00, Jonathan Glass wrote:
> > On Wed, 2003-12-10 at 11:48, Nick Travis wrote:
> > > I'm working on a script that creates a static webpage that lists all of
> > > the files in a directory, it's working fine except for one thing.  I'm
> > > getting a blank space when I create the line of html.
> > > here's the code:
> > > 
> > > > # create the html to be added to files.html
> > > > first="<p><a href=\"/music/"
> > > > middle="\" >"
> > > > end="</a></p>"
> > > >                                                                                 
> > > > echo $first $current_file $middle $current_file $end >> /usr/local/apache2/htdocs/music/files.html
> > > 
> > > Here's what it gives me:
> > > /music/ my-file
> > > 
> > > I need to get:
> > > /music/my-file
> > > 
> > > any thoughts?  I'm not very experienced in shell scripting, so there's probably a better way to accomplish the same thing.
> > > 
> > > Thanks
> > > Nick
> > 
> > echo $first$current_file$middle$current_file$end >>
> > /usr/local/apache2/htdocs/music/files.html
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> If you have any questions please contact nick at precisionmillworks.com
> Mailscanner thanks transtec Computers for their support.
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list