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
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
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.
"printenv caller" will display value for instance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It looks like first command sequence misses eol after last line...