I am using global variable as INSTALL_DIR='/tmp' and then am calling function to use that variable in shell script
Which is the correct method from the following to use the variable?
Method 1:-
INSTALL_DIR='/tmp'
install_app() {
echo "application path - $INSTALL_DIR"
}
install_app
Method 2:-
INSTALL_DIR='/tmp'
install_app() {
app=$1
echo "application path - $app"
}
install_app $INSTALL_DIR