[opensuse-factory] file named : /usr/bin/[ : repeat : " [ "
Hello List, - in case of interest : see a file in /usr/bin named " [ " : -rwxr-xr-x 1 root root 39704 Sep 28 21:42 [ ....................... - is this orthodox ? thanks regards -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Thu, Oct 02, 2014 at 08:39:01PM +0300, ellanios82 wrote:
Hello List,
- in case of interest : see a file in /usr/bin named " [ " :
-rwxr-xr-x 1 root root 39704 Sep 28 21:42 [
.......................
- is this orthodox ?
Why? Run man [ Werner -- "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr
On 10/02/2014 08:40 PM, Dr. Werner Fink wrote:
a file in /usr/bin named " [ " :
-rwxr-xr-x 1 root root 39704 Sep 28 21:42 [
.......................
- is this orthodox ?
Why? Run
man [
Dr Werner ~ thank you regards -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
ellanios82 wrote on 2014-10-02 21:06 (UTC+0300):
Dr. Werner Fink wrote: ...
a file in /usr/bin named " [ " :
-rwxr-xr-x 1 root root 39704 Sep 28 21:42 [
Why? Run man [
I see it, but I don't get how "[" relates to a man page for "BASH_BUILTINS" or "General Commands Manual"? -- "The wise are known for their understanding, and pleasant words are persuasive." Proverbs 16:21 (New Living Translation) Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata *** http://fm.no-ip.com/ -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2014-10-02 20:37, Felix Miata wrote:
ellanios82 wrote on 2014-10-02 21:06 (UTC+0300):
Dr. Werner Fink wrote: ...
a file in /usr/bin named " [ " :
-rwxr-xr-x 1 root root 39704 Sep 28 21:42 [
Why? Run man [
I see it, but I don't get how "[" relates to a man page for "BASH_BUILTINS" or "General Commands Manual"?
because there are both an "external" program with that name, and an internal bash builtin, with the same name and functionality. Bash uses the internal code, obviously. I don't know what uses the external, probably other (older / more basic) shells. - -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlQtnWUACgkQtTMYHG2NR9Wf/ACdG5pvuCDt1AW4HviFtM9t+H1s gG8AnAhEklIJaimWY8rFn/qM87kFDJ4A =6WE6 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On 10/02/2014 08:45 PM, Carlos E. R. wrote:
because there are both an "external" program with that name, and an internal bash builtin, with the same name and functionality. Bash uses the internal code, obviously. I don't know what uses the external, probably other (older / more basic) shells.
That's part of coreutils and (almost) the same as /usr/bin/test. This caters for the case where a program would not be able to use the shell's '[' builtin. $ '/usr/bin/[' --help Have a nice day, Berny -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On 10/03/2014 12:09 AM, Bernhard Voelker wrote:
That's part of coreutils
sorry, here's the missing proof: $ rpm -qf '/usr/bin/[' coreutils-8.21-7.16.1.x86_64 Have a nice day, Berny -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Hello, On Fri, 03 Oct 2014, Bernhard Voelker wrote:
That's part of coreutils and (almost) the same as /usr/bin/test.
Actually, it used to be a symlink or hardlink to /bin/test. I just checked: $ pin -v 9.1 '/usr/bin/test$' |tail -1; pin -v 9.1 '/usr/bin/\[' |tail -1; ./CD1/suse/i586/coreutils-5.2.1-23.i586.rpm: -rwxr-xr-x root\ root 27577 Apr 6 03:58 /usr/bin/test ./CD1/suse/i586/coreutils-5.2.1-23.i586.rpm: -rwxr-xr-x root\ root 29359 Apr 6 03:58 /usr/bin/[ $ pin -v 8.2 '/usr/bin/test$' |tail -1; pin -v 8.2 '/usr/bin/\[' |tail -1; ./CD1/suse/i586/coreutils-4.5.8-11.i586.rpm: -rwxr-xr-x root\ root 23616 Mar 14 03:00 /usr/bin/test ./CD1/suse/i586/coreutils-4.5.8-11.i586.rpm: lrwxrwxrwx root\ root 4 Mar 14 03:00 /usr/bin/[ -> test -dnh -- Don't Panic -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On 10/04/2014 05:44 PM, David Haller wrote:
On Fri, 03 Oct 2014, Bernhard Voelker wrote:
That's part of coreutils and (almost) the same as /usr/bin/test.
Actually, it used to be a symlink or hardlink to /bin/test. I just checked:
$ pin -v 9.1 '/usr/bin/test$' |tail -1; pin -v 9.1 '/usr/bin/\[' |tail -1; ./CD1/suse/i586/coreutils-5.2.1-23.i586.rpm: -rwxr-xr-x root\ root 27577 Apr 6 03:58 /usr/bin/test ./CD1/suse/i586/coreutils-5.2.1-23.i586.rpm: -rwxr-xr-x root\ root 29359 Apr 6 03:58 /usr/bin/[
$ pin -v 8.2 '/usr/bin/test$' |tail -1; pin -v 8.2 '/usr/bin/\[' |tail -1; ./CD1/suse/i586/coreutils-4.5.8-11.i586.rpm: -rwxr-xr-x root\ root 23616 Mar 14 03:00 /usr/bin/test ./CD1/suse/i586/coreutils-4.5.8-11.i586.rpm: lrwxrwxrwx root\ root 4 Mar 14 03:00 /usr/bin/[ -> test
Indeed. Between those 2 (ancient) versions, commit [1] made 'test' and '[' behave differently to fulfill the GNU coding standard versus the POSIX standard (i.e. accepting --help and --version or not, not based on argv[0] any longer): [1] http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=05731b4717 Compare the behavior with --help for both programs: $ diff -u \ <( '/usr/bin/test' --version ) \ <( '/usr/bin/[' --version ) --- /dev/fd/63 2014-10-05 11:29:37.629953087 +0200 +++ /dev/fd/62 2014-10-05 11:29:37.646955619 +0200 @@ -0,0 +1,7 @@ +[ (GNU coreutils) 8.21 +Copyright (C) 2013 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. + +Written by Kevin Braunsdorf and Matthew Bradburn. Have a nice day, Berny -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Thu, 02 Oct 2014 20:39:01 +0300 ellanios82 <ellanios82@gmail.com> wrote:
Hello List,
- in case of interest : see a file in /usr/bin named " [ " :
-rwxr-xr-x 1 root root 39704 Sep 28 21:42 [
.......................
- is this orthodox ?
Originally, the Bourne shell "if" was of the form if command ; then ... fi The shell would run the command and see if it succeeded (gave a return value of 0). You can still use "if" that way, though it is often considered bad form. If you would instead like to have: if [ expression ] ; then ... fi then the obvious way to do that is to have a command named "[" whose job is to evaluate its arguments (excluding a final "]") as a logical expression and to succeed (return 0) if the expression is true. That's how the command "[" got started. And it is still there for backward compatibility (if you have a really really old version of Bourne shell). -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On 10/03/2014 08:43 AM, Neil Rickert wrote:
On Thu, 02 Oct 2014 20:39:01 +0300 ellanios82 <ellanios82@gmail.com> wrote:
Hello List,
- in case of interest : see a file in /usr/bin named " [ " :
-rwxr-xr-x 1 root root 39704 Sep 28 21:42 [
.......................
- is this orthodox ?
Originally, the Bourne shell "if" was of the form
if command ; then ... fi
The shell would run the command and see if it succeeded (gave a return value of 0). You can still use "if" that way, though it is often considered bad form.
If you would instead like to have:
if [ expression ] ; then ... fi
then the obvious way to do that is to have a command named "[" whose job is to evaluate its arguments (excluding a final "]") as a logical expression and to succeed (return 0) if the expression is true.
That's how the command "[" got started. And it is still there for backward compatibility (if you have a really really old version of Bourne shell). ...............
- interesting : thank you ............. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
participants (7)
-
Bernhard Voelker
-
Carlos E. R.
-
David Haller
-
Dr. Werner Fink
-
ellanios82
-
Felix Miata
-
Neil Rickert