[CMake] $ENV{HOSTNAME}
Salvatore Iovene
salvatore.iovene+cmake at googlemail.com
Wed Nov 21 09:02:27 EST 2007
> On Nov 21, 2007 3:56 PM, Gonzalo Garramuño <ggarra at advancedsl.com.ar> wrote:
> > Salvatore Iovene wrote:
> > >
> > > A bug? Thanks.
> > >
> >
> > Nope.
> >
> > $ echo $HOSTNAME
> > aura1
> >
> > $ sh -c "echo \$HOSTNAME"
> >
> > $ bash -c "echo \$HOSTNAME"
> > aura1
> >
> > Basically, HOSTNAME is a variable that is set by some shells like bash
> > only, but cmake for speed and consistency runs commands using the most
> > basic unix shell (ie. sh), which does not set that variable by default.
>
> Thanks. How can I work this around? I really need to get the HOSTNAME in a
> shell-independent way. Maybe there's a way to execute the `hostname`
> command?
Besides:
siovene at sd024:/work/trunk/libraries$ sh -c "echo \$HOSTNAME"
sd024
siovene at sd024:/work/trunk/libraries$ /bin/sh -c "echo \$HOSTNAME"
sd024
siovene at sd024:/work/trunk/libraries$ ls -lh /bin/sh
lrwxrwxrwx 1 root root 4 2007-11-13 16:18 /bin/sh -> bash
So sh is actually bash, on my machine.
--
Salvatore Iovene
http://www.iovene.com/
Key Fingerprint: 5647 944D D5AD 2E87 00B4 7D54 2864 359D FF20 16D8
More information about the CMake
mailing list