#!/usr/bin/perl # This perl script sets the shell environment variable with $ENV{BB}, # then runs some Unix commands with back-quotes and \$BB . # # This script outputs, # Shell environment variable BB has been changed to: /var/log # One directory back, via back-quotes is: /var # The following makes available the environment variable $CC . printf "The current environment variable \$CC is: %s\n", $ENV{CC} ; $ENV{BB}="/var/log" ; #CHANGE ENVIRONMENT. printf "Shell environment variable \$BB has been changed to: %s \n", $ENV{BB} ; # In the following, note \$BB so $ gets interpreted # by the shell (in backquotes) rather than by perl. printf `cd \$BB; cd ..; echo -n "One directory back, via back-quotes is: "; pwd ` ;