[plug] function error

Jon Miller jlmiller at mmtnetworks.com.au
Thu Jan 12 01:12:47 WST 2006


Thanks for that.  Will have a look at the man pages.

Jon

>>> troll at arach.net.au 12:58:34 am 12/01/2006 >>>
On Wednesday 11 January 2006 23:57, Jon Miller wrote:
> Answer to third item - Not a lot, I've been having a read through the advance bash scripting.  I've done programming in some C (about a few eons ago), but I usually steer clear of this as I do not have the time to get to involved.  But there are times when I need to knock out a quick script.

variables used and defined in functions are accessible only to that function - local

to use a global variable define it at the beginning
eg-
VAR1=""

you can also use a declare statement
to create an array -
declare -a VAR2

help declare
for more info

to write to a variable use it straight -
VAR1="some value"
VAR2[0]="some other value"

to access the values use a dollar sign in front {} gives more clarity and must be used 
with array variables.
echo $VAR1
echo ${VAR2[0]}

for more info on bash scripting do
man bash
or
info bash

this is one of the lengthiest man pages I've seen but it covers everything used in bash.

-- 
regs MR E_T
_______________________
\                      \
  \   OOHH I hate TYPOS  \
    \                      \
      ~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
PLUG discussion list: plug at plug.org.au 
http://www.plug.org.au/mailman/listinfo/plug 
Committee e-mail: committee at plug.linux.org.au




More information about the plug mailing list