Hello,

tst is a shell script that does specify which interpreter should be used
and therefore the system falls back to try /bin/sh.

However the script is using bash extensions ([ "$1" == "" ]) which won't
work with *any* sh-type shell. Debian is using dash as /bin/sh and there
an error is thrown, Centos is probably using bash.

So this is not a bug but a user error. If you want to use bash-extension
you'll need to take care that the script runs under bash by using a
correct #!-line.

Closing.

** Changed in: findutils (Ubuntu)
       Status: Confirmed => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to findutils in Ubuntu.
https://bugs.launchpad.net/bugs/1793668

Title:
  xargs gives "[: err: unexpected operator" on Ubuntu but not Centos

Status in findutils package in Ubuntu:
  Invalid

Bug description:
  cd /tmp
  rm -Rf tst err
  echo 'if [ "$1" == "" ]; then echo "empty"; else cat $1; fi' > tst
  chmod +x tst
  echo "a" > err
  ls err | xargs ./tst # ./tst: 1: [: err: unexpected operator
  ./tst err # works fine, outputs 'a'

  On Ubuntu the error will be shown, on Centos it won't. The error looks
  to be incorrect.

  $ lsb_release -rd
  Description: Ubuntu 18.04.1 LTS
  Release: 18.04
  $ xargs --version
  xargs (GNU findutils) 4.7.0-git
  Copyright (C) 2017 Free Software Foundation, Inc.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/findutils/+bug/1793668/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to