Home | Fedora Core 4 Tutorial | Linux Tutorials | Linux Games | Linux Java | Linux Kernal | Linux Firewall | Linux Database | Linux Distributions | Linux Firewall GUI | Linux Distributions | Linux Firewall

 


 

Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

Tutorials

Java Server Pages

JAXB

Java Beans

JDBC

MySQL

Java Servlets

Struts

Bioinformatics

Java Code Examples

Interview Questions

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting

Linux

Beginner Guide to Linux Server

Linux Distribution

Major Linux Distribution

Linux FTP Software

Frameworks

Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers

Softwares

Adware & Spyware Remover

Open Source Softwares

3.1. Variables

I'm not going to try to explain all the details of Bash scripting in a section of this HOWTO, just the details pertaining to prompts. If you want to know more about shell programming and Bash in general, I highly recommend Learning the Bash Shell by Cameron Newham and Bill Rosenblatt (O'Reilly, 1998). Oddly, my copy of this book is quite frayed. Again, I'm going to assume that you know a fair bit about Bash already. You can skip this section if you're only looking for the basics, but remember it and refer back if you proceed much farther.

Variables in Bash are assigned much as they are in any programming language:

testvar=5
foo=zen
bar="bash prompt"

Quotes are only needed in an assignment if a space (or special character, discussed shortly) is a part of the variable.

Variables are referenced slightly differently than they are assigned:

> echo $testvar
5
> echo $foo
zen
> echo ${bar}
bash prompt
> echo $NotAssigned

> 

A variable can be referred to as $bar or ${bar}. The braces are useful when it is unclear what is being referenced: if I write $barley do I mean ${bar}ley or ${barley}? Note also that referencing a value that hasn't been assigned doesn't generate an error, instead returning nothing.

Search Tutorials

Linux Distributions

Fedora

Slackware
SuSe
Mandrake
Knoppix
Mepis
Debian
All Distors....
 

 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2004. All rights reserved.