J'utilise la variable globale en tant que INSTALL_DIR = «/tmp » et je appelle la fonction d'utiliser cette variable dans le script shellQuelle est la meilleure façon d'utiliser la variable dans le script shell
Quelle est la bonne méthode parmi les suivantes utiliser la variable?
Méthode 1: -
INSTALL_DIR='/tmp'
install_app() {
echo "application path - $INSTALL_DIR"
}
install_app
Méthode 2: -
INSTALL_DIR='/tmp'
install_app() {
app=$1
echo "application path - $app"
}
install_app $INSTALL_DIR