From owner-freebsd-questions@FreeBSD.ORG Mon Aug 9 05:09:56 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB1A81065679 for ; Mon, 9 Aug 2010 05:09:56 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) by mx1.freebsd.org (Postfix) with ESMTP id 197988FC0A for ; Mon, 9 Aug 2010 05:09:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id o7959lR5060763; Mon, 9 Aug 2010 15:09:47 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Mon, 9 Aug 2010 15:09:46 +1000 (EST) From: Ian Smith To: Polytropon In-Reply-To: <20100808181018.5710810656D8@hub.freebsd.org> Message-ID: <20100809132418.G66749@sola.nimnet.asn.au> References: <20100808181018.5710810656D8@hub.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-questions@freebsd.org, Antonio Olivares Subject: Re: ANNOUNCE: Custom 64bit FreeBSD 8.1-RELEASE with XFCE packages released X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 05:09:56 -0000 In freebsd-questions Digest, Vol 322, Issue 16, Message: 14 On Sun, 8 Aug 2010 17:44:36 +0200 Polytropon wrote: > On Sun, 8 Aug 2010 10:33:30 -0500, Antonio Olivares wrote: > > This is it I guess. I chose bash shell and the default schell is the csh. > > > > There is a file called .login in my home directory > > /home/olivares/.login which has: > > > > $ $FreeBSD: src/share/skel/dot.login,v 1.17.2.1.5.1 2010/06/14 > > 02:09:06 kensmith > > Exp % > > # > > # .login - csh login script, read by login shell after '.cshrc' at login. > > # > > # see also csh(1), environ(7), > > # > > if (-x /usr/games/fortune ) /usr/games/fortune freebsd-tips > > if [! -f /tmp/.X0-lock ]; then > > /usr/local/bin/startx > > fi Hi, I don't know if Antonio is still using that syntax in later versions but the '[' (test) command requires a space between '[' and arguments, ie in either csh, sh or bash (though I only tend to use csh interactively) the syntax '[!' doesn't work .. perhaps that's what produces the message: > > -bash: [ !: command not found mentioned in later messages? Some tests: smithi on sola% sh -c '[ ! -f /etc/hosts ] && echo "hosts not found" || echo "hosts found"' hosts found smithi on sola% sh -c '[! -f /etc/hosts ] && echo "hosts not found" || echo "hosts found"' [!: not found hosts found smithi on sola% bash -c '[ ! -f /etc/hosts ] && echo "hosts not found" || echo "hosts found"' hosts found smithi on sola% bash -c '[! -f /etc/hosts ] && echo "hosts not found" || echo "hosts found"' bash: [!: command not found hosts found Of course 'hosts found' is a misleading response for the '[!' tests; it just means that the test command failed. With a non-existing file: smithi on sola% sh -c '[ ! -f /etc/boo ] && echo "boo not found" || echo "boo found"' boo not found smithi on sola% sh -c '[! -f /etc/boo ] && echo "boo not found" || echo "boo found"' [!: not found boo found smithi on sola% bash -c '[ ! -f /etc/boo ] && echo "boo not found" || echo "boo found"' boo not found smithi on sola% bash -c '[! -f /etc/boo ] && echo "boo not found" || echo "boo found"' bash: [!: command not found boo found Again 'boo found' just means the '[' (test) command failed; '[!' is bad. > > and it clearly says that is for 'csh login', so I would need something else? > > Yes. According to "man bash", section "INVOCATION", mentiones > other file names: Bash reads and executes ~/.bash_profile, > ~/.bash_login, and ~/.profile (in that order), so you can > add the line "[ ! -f /tmp/.X0-lock ] && startx" (short form > is completely okay and valid) at the end of ~/.bash_login - > or also .profile, but it makes more sense in putting it into > something related to "login" rather than a "profile", but > that's debatable semantics. :-) I'm not really sure about that; even at the very end of ~/.bash_profile running startx (a script that doesn't exit till you quit X) might be a bit dodgy, ie does bash expect sourcing ~/.bash_profile to return immediately? I guess Antonio might have to see which of those work. The debian system I look after doesn't have any .bash_login files; apart from the system-wide files in /etc (best untouched) most of the business is done in ~/.bashrc, invoked for interactive shells by ~/.bash_profile, but I'm unsure whether the login shell (that doesn't use ~/.bashrc) then invokes an interactive shell (that does) or what .. man bash is awful :) > The line "[ ! -f /tmp/.X0-lock ] && startx" is correct C shell, > sh (Bourne) and bash syntax. It is - but only with that space after '[' - and of course before ']' HTH, Ian