Archiwum kategorii Linux

Przykłady kodów

Autor: Tomasz Masier dnia czwartek, 28 Kwiecień, 2011

Kod bash:


#!/bin/bash
#Define bash global variable
#This variable is global and can be used anywhere in this bash script
VAR="global variable"
function bash {
#Define bash local variable
#This variable is local to bash function only
local VAR="local variable"
echo $VAR
}
echo $VAR
bash
# Note the bash global variable did not change
# "local" is bash reserved word
echo $VAR

Czytaj dalszą część tego wpisu »


© 2012 nsec.pl