help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Internal functions


From: Bill Gradwohl
Subject: [Help-bash] Internal functions
Date: Wed, 28 Mar 2012 22:30:38 -0600

The following code:

#!/bin/bash

syntax() {
   echo syntax in main address@hidden
}

func1() {
   syntax() {
      echo syntax in func1 address@hidden
   }
   syntax
return 0
}
syntax
func1
syntax

Produces this output.
address@hidden ycc# ./junk
syntax in main syntax main
syntax in func1 syntax func1 main
syntax in func1 syntax main

Is there any way to declare the syntax function in func1 so that it is "local" only to func1?

I don't want it polluting main. When func1 terminates, I want the syntax in func1 to terminate with it.

Is there any way to declare some kind of name space?

--
Bill Gradwohl


reply via email to

[Prev in Thread] Current Thread [Next in Thread]