On Tue, Sep 07, 2010 at 06:03:11PM +0200, Julien Danjou wrote:
> On Tue, Sep 07 2010, Bill Sun wrote:
>
> > I want to judge hostname in rc.lua, in order to have different settings in
> > different
> > hosts.
>
> hostname = awful.util.pread("hostname")
>
I'd do awful.util.pread("hostname -f"):gsub("\n", "")
That way a) the trailing newline is removed, allowing simple string
equality tests and b) the fully qualified hostname is used, which may
aid porting the rc to a different OS. I had that with *BSD a week or two
ago, where hostname defaulted to FQDN, where in Linux it was just the
local host part.
--
$l="\n";$p=q-sub r{rand}sub c{((shift)**2+(shift)**2)<1}while(
$i++<=$s){$t++if c r,r}die("Gregor Best, 0xDB9F9A7C, ".($t/$s*
4).$l)-;$s+=ord$$|$_ for split //,$p;srand($s|$$);eval$p;die$@
pgpbJcRs2iYWA.pgp
Description: PGP signature
