Link to home
Start Free TrialLog in
Avatar of tiger0516
tiger0516

asked on

C shell question

#!/bin/csh
setenv caller "enviroment1"
echo $caller
setenv caller "enviroment2"
echo $caller
set caller="ordinary1"
echo $caller
set caller="ordinary2"
echo $caller

output is

enviroment1
enviroment2
ordinary1


But

#!/bin/csh
setenv caller "enviroment1"
echo $caller
setenv caller "enviroment2"
echo $caller
set caller="ordinary1"
echo $caller
set caller="ordinary2"
echo $caller
printenv $caller

output is

enviroment1
enviroment2
ordinary1
ordinary2

Why?

thanks
Avatar of Tintin
Tintin

printenv is a csh builtin, and echo is an external command that will only see exported variables (ie: setenv)
printenv takes variable name as parameter.

"printenv caller" will display value for instance.
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It looks like first command sequence misses eol after last line...