[plug] function error

Mr E_T troll at arach.net.au
Thu Jan 12 00:58:34 WST 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  \
    \                      \
      ~~~~~~~~~~~~~~~~~~~~~~~



More information about the plug mailing list