public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: ltp-list@lists.sourceforge.net
Cc: Jiri Palecek <jirka@debian.org>
Subject: Re: [LTP] [PATCH] Fix some bashisms
Date: Mon, 6 Jul 2009 18:02:12 -0400	[thread overview]
Message-ID: <200907061802.13418.vapier@gentoo.org> (raw)
In-Reply-To: <364299f40907061045s567f00dbq7a198ef37fa438dc@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1541 bytes --]

On Monday 06 July 2009 13:45:08 Garrett Cooper wrote:
> 2. All numeric test(1) comparisons could and should be switched from:
>
> command
> if [ $? = 0 ]; then
>
> to:
>
> if command; then
>
> for brevity.

that works the command is sufficiently short.  if it's a long command and/or 
has line wrappings itself, i find nesting it in the if statement makes the 
situation much worse.

> 3. About &>
>
>    Redirecting Standard Output and Standard Error
>        Bash allows both the standard output (file descriptor 1) and
> the standard error output (file descriptor 2) to be redirected to the
> file whose name is the expansion of word with this construct.
>
>        There are two formats for redirecting standard output and standard
> error:
>
>               &>word
>        and
>
>               >&word
>
> The output redirection above captures all output (and most of the time
> you're capturing stdout, but losing stderr to the operating console,
> which can be undesirable). >& is more portable IIRC (it works with
> many ash variants, like FreeBSD's sh -- for sure -- and Solaris's sh
> -- IIRC), which makes it more ideal than &>.

what bash does doesnt matter.  the redirection used needs to be in POSIX:
http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07

the "&>" form is not in POSIX, so should never be used.  the ">&" format 
cannot be used in POSIX without a word argument (you didnt say it could, just 
making sure things are kept explicit).
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 79 bytes --]

------------------------------------------------------------------------------

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2009-07-06 22:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4a413e9b.160bca0a.2226.fffff184SMTPIN_ADDED@mx.google.com>
2009-07-06 17:45 ` [LTP] [PATCH] Fix some bashisms Garrett Cooper
2009-07-06 22:02   ` Mike Frysinger [this message]
2009-07-06 22:47   ` Jiri Palecek
2009-07-06 23:33     ` Garrett Cooper
2009-07-07  0:16       ` Jiří Paleček
2009-07-07  0:31         ` Garrett Cooper
2009-07-07 10:29           ` Jiří Paleček
     [not found] <200910211528.n9LFST8q028289@e35.co.us.ibm.com>
2009-10-26 17:02 ` Subrata Modak
2009-10-26 19:37   ` Garrett Cooper
2009-10-29 18:12   ` JiříPaleček
2009-10-30 11:37     ` Subrata Modak
2009-10-30 12:53       ` Jiří Paleček
2009-10-30 12:19         ` Subrata Modak
2009-10-31  6:39           ` Garrett Cooper
2009-10-31 11:42             ` Jiří Paleček
2009-11-01  0:15               ` Garrett Cooper
     [not found] <4adf2acd.8b13f30a.0849.7847SMTPIN_ADDED@mx.google.com>
2009-10-21 19:38 ` Mike Frysinger
2009-10-21  0:19 Jiri Palecek
  -- strict thread matches above, loose matches on Subject: below --
2009-07-07  8:35 Jiri Palecek
2009-07-07 15:32 ` Subrata Modak
2009-07-07 16:26   ` Garrett Cooper
2009-07-08 19:05   ` Mike Frysinger
2009-07-08 18:13 ` Subrata Modak
     [not found] <4a413e95.8d13f30a.1199.ffffdccbSMTPIN_ADDED@mx.google.com>
2009-06-23 21:21 ` Mike Frysinger
2009-06-25  9:09   ` Subrata Modak
2009-06-30  7:41     ` Subrata Modak
2009-07-06 23:12       ` Jiri Palecek
2009-05-31 21:27 Jiri Palecek >

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200907061802.13418.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=jirka@debian.org \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox