Search :

Custom Search

Rabu, 11 Juni 2008

Default Linux Shell Variable

Tonight, my friend in singapore has ask me about linux shell variable.. Hm… come my opinion, variable shell dalam linux tuh likes $cwd, $PWD, $path, $PATH, $term, $TERM. Jadi untuk lebih yakinnya gw langsung googling ajah…
System Unix ato LInux sebenarnya mempunyai banyak perbedaan shell, tetapi pada penerapannya hampir sama semua. Ada 2 shell yang vamiliar ato popular in Unix/Linux, yaitu tcsh and bash. In Linux Shell, there are two types of variable. There are System variables and User defined variables (UDV). If on System variables, created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS. And on User defined variables (UDV, created and maintained by user. This type of variable defined in lower letters.
You can see system variables by giving command like $ set, some of the important System variables are :
BASH=/bin/bash >> [ Our shell name]BASH_VERSION=1.14.7(1) >> [ Our shell version name ]COLUMNS=80 >> [ No. of columns for our screen ]HOME=/home/vivek >> [ Our home directory ]LINES=25 >> [ No. of columns for our screen ]LOGNAME=students >> [ students Our logging name ]OSTYPE=Linux >> [ Our Os type ]PATH=/usr/bin:/sbin:/bin:/usr/sbin >> [ Our path settings ]PS1=[\u@\h \W]\$ >> [ Our prompt settings ]PWD=/home/students/Common >> [ Our current working directory ]SHELL=/bin/bash >> [ Our shell name ]USERNAME=vivek >> [ User name who is currently login to this PC
There are some Linux System Variable..But itu semua tergantung pada setting that can be different in your PC/Linux environment.
Untuk melihat system variablenya, ketik pada console : $ set
You can easily view all the environmental variables in the current session with the env command, type env,
$ env
TERM=vt102SHELL=/bin/bashSSH_CLIENT= 54620 22OLDPWD=/export/home/oracleSSH_TTY=/dev/pts/1USER=oracleMAIL=/var/mail//oraclePATH=/usr/bin:/usr/ucb:/etc:.PWD=/u01TZ=US/EasternPS1=$SHLVL=1HOME=/export/home/oracleLOGNAME=oracleSSH_CONNECTION= 54620 22_=/usr/bin/env
Itu semua variable defaultnya.
My Genius Brain :p

Tidak ada komentar: