shell scripts need to pay attention

shell script, the function of the internal variables may be defined as the local and global variables, local variables define local, global variables with no local, global variables can be visible outside the function, as follows:

#!/bin/bash

function callee(){
   name="cnblogs"
}

function caller(){
   callee
   echo $name
}

caller
echo $name

 

Guess you like

Origin www.cnblogs.com/glensblog/p/11162118.html