[shell] script's return status

Michael Shigorin <[email protected]>
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
On Sun, Mar 30, 2008 at 01:06:27AM -0400, Warren Togami wrote:
> >> [ -e /selinux/enforce ] && /sbin/restorecon -R $TFTPDIR &> /dev/null
> > i'm not going to defend that code... :)
> Seriously, this is a self-contained line of code that is clearly correct.

It's obviously incorrect being the last code line in a script.

You might want to see it for %post/%pre/%anything_like_that as well:

$ true && echo true; echo $? 
true
0
$ false && echo true; echo $? 
1
$ ! true || echo true; echo $? 
true
0
$ ! false || echo true; echo $?
0

The difference is in exit code which can suddenly become
non-zero, and being the last line this determines the whole
script's execution status.

This nuance cost me enough trouble in package scripts breaking
upgrades for no good reason... was thankful for an example like
these four lines given by one of the more experienced teamers
(rider@).

> Furthermore it isn't really distro-specific given that SELinux
> is the preferred in the upstream kernel and even Ubuntu is
> making it optional soon.

I think "ALT too", but that doesn't really matter.

> If you don't have SELinux then does nothing, so you can happily
> ignore it.

When we fix it, yes 8)

-- 
 ---- WBR, Michael Shigorin <mike-u2l5PoMzF/[email protected]>
  ------ Linux.Kiev http://www.linux.kiev.ua/

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.