All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] tst_test.sh: Add test cmd helper tst_test_cmds()
Date: Mon, 9 Apr 2018 20:44:59 +0200	[thread overview]
Message-ID: <20180409184459.GA26623@x230> (raw)
In-Reply-To: <20180409131852.GD26048@rei.lan>

Hi Cyril,

> > > +		which $1 > /dev/null 2>&1 || return 1
> > Pedantic version would check $? for 127 (indicating which itself it's not found).
> > Probably worth of adding it.

> Are you sure?

> $ which foo
> ...
> $ echo $?
> 1

> Also:

> $ busybox which foo
> $ echo $?
> 1

Yes, exit code 1 is when 'which' command doesn't find command.
Exit code 127 at least some shells use when command not found (in this case when 'which'
command itself is not found.

$ busybox foo; echo $?
foo: applet not found
127

Missing which IMHO only the case of busybox build with CONFIG_WHICH=n (but default is 'y')
=> corner case. I understand if we want to ignore it.

(+ Android - at least old versions had 'toolbox' instead of busybox => we'd ignore this
Android it's special and currently not fully supported anyway.


Kind regards,
Petr

  reply	other threads:[~2018-04-09 18:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06  6:42 [LTP] [PATCH 1/1] tst_test.sh: Add test cmd helper tst_test_cmds() Petr Vorel
2018-04-06  7:08 ` Petr Vorel
2018-04-09 13:18   ` Cyril Hrubis
2018-04-09 18:44     ` Petr Vorel [this message]
2018-04-09 13:14 ` Cyril Hrubis
2018-04-09 18:52   ` Petr Vorel

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=20180409184459.GA26623@x230 \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.