Re: : Openbox autostart - detecting hostname

Giles Orr <[email protected]> Tue, 12 Aug 2014 12:39:51 -0400
Newsgroups gmane.org.user-groups.linux.tolug
Message-ID <CAEnxSC52pNeOCYu6L9YG69PYXbFxV6pz3hv_Lht5EbxcGW37hA@mail.gmail.com>
On 12 August 2014 12:20, Mauro Souza <[email protected]> wrote:

> 2014-08-12 9:16 GMT-03:00 Giles Orr <[email protected]>:
>
> On 12 August 2014 02:41, William Park <opengeometry-FFYn/[email protected]> wrote:
>>  > On Mon, Aug 11, 2014 at 09:17:28PM -0400, Giles Orr wrote:
>> > > I'm using openbox on an Acer Chromebook (full install, not crouton).
>>  I'm
>> > > pretty pleased with the hardware, but I've got a problem with
>> Openbox's
>> > > autostart file.  It's a shell script, so I should be able to make
>> decisions
>> > > about what to run based on the hostname.  This matters because I share
>> > > configuration files and dotfiles across multiple hosts.  But it
>> doesn't
>> > > work.  I've tried:
>> > >
>> > > if [ "$(hostname)" == "crom" ] # works at the command line
>> > > then
>> > >     xterm -fn terminus-18 &
>> > > fi
>> > >
>> > > if [ "${HOSTNAME}" == "crom" ] # ditto
>> > > ...
>> > >
>> > > if [ "$(cat /etc/hostname)" == "crom" ] # ditto
>> > > ...
>> > >
>> > > None work in ~/.config/openbox/autostart .  I dumped $(env) to a file
>> from
>> > > within the autostart and HOSTNAME isn't set, so that explains the
>> middle
>> > > one failing, but I have no explanation for why the others don't work.
>>  Can
>> > > anyone help?
>> >
>> > Try single '=', or use Bash/Ksh which support '=='.
>>
>> Thanks Walter - I do have the file.
>>
>> William - that's a very good point: I was automatically assuming Bash
>> because it's what I use all the time, and that may well NOT be what's used
>> by Openbox.  It obviously uses a shell of some sort, but which one is open
>> to question.  I will confirm later.  Thanks!
>>
>
> echo $SHELL generally tells you which shell you are using.
>
> Mauro
> http://mauro.limeiratem.com - registered Linux User: 294521
> Scripture is both history, and a love letter from God.
>

Excellent: I'll give that a shot.

-- 
Giles
http://www.gilesorr.com/
[email protected]