Date: Mon, 9 Aug 2010 15:09:46 +1000 (EST) From: Ian Smith <smithi@nimnet.asn.au> To: Polytropon <freebsd@edvax.de> Cc: freebsd-questions@freebsd.org, Antonio Olivares <olivares14031@gmail.com> Subject: Re: ANNOUNCE: Custom 64bit FreeBSD 8.1-RELEASE with XFCE packages released Message-ID: <20100809132418.G66749@sola.nimnet.asn.au> In-Reply-To: <20100808181018.5710810656D8@hub.freebsd.org> References: <20100808181018.5710810656D8@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In freebsd-questions Digest, Vol 322, Issue 16, Message: 14 On Sun, 8 Aug 2010 17:44:36 +0200 Polytropon <freebsd@edvax.de> wrote: > On Sun, 8 Aug 2010 10:33:30 -0500, Antonio Olivares <olivares14031@gmail.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100809132418.G66749>