#!/bin/sh myecho() { echo $var } foo() { local var="foo: bye bye" var="foo: hello world" myecho } bar() { var="bar: hello world" myecho } foo bar