Tuesday, July 31, 2007

View the Value of a UNIX Variable

Sometimes you might want to display the contents of a variable. Why? It might be set to an incorrect value. Here's a couple basic ways of doing that.

Set variable
# csh
# setenv ESOFT /export/home/esofthub
or
# sh
# ESOFT=/export/home/esofthub; export ESOFT

View variable contents
# echo $ESOFT
/export/home/esofthub
# env | grep ESOFT
ESOFT=/export/home/esofthub

Other miscellaneous uses
# cd /
# cd $ESOFT; pwd
# ls $ESOFT
# $ESOFT/myscript.csh
THIS IS A TEST

2 comments:

Freddie Sirmans said...

Just browsing the internet, you have a very, very interesting blog.

esofthub said...

Thanks freddie sirmans