Unusual file: /bin/[
Hi, I spotted what i'd call an unusual file in the basejail on a jail install, and have since seen this on other non jailed boxes. -r-xr-xr-x 2 root wheel 11488 Jun 10 12:19 [ man [ reveals test, [ -- condition evaluation utility just checking thats all ok, and i've not been rooted! -- - Paul Macdonald IFDNRG Ltd Web and video hosting - t: 0131 5548070 m: 07970339546 e: p...@ifdnrg.com w: http://www.ifdnrg.com - IFDNRG 40 Maritime Street Edinburgh EH6 6SA High Specification Dedicated Servers from £100.00pm ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Unusual file: /bin/[
On 07/29/13 15:25, Paul Macdonald wrote: Hi, I spotted what i'd call an unusual file in the basejail on a jail install, and have since seen this on other non jailed boxes. -r-xr-xr-x 2 root wheel 11488 Jun 10 12:19 [ That's a perfectly valid UNIX program used in (bourne) shell programming. It has been part of BSD Unix for ages. And I really mean AGES! just checking thats all ok, and i've not been rooted! Don't worry about it. It's perfectly legitimate. -cpghost. -- Cordula's Web. http://www.cordula.ws/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Unusual file: /bin/[
That's a real binary, also known as /bin/test ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Unusual file: /bin/[
On Mon, 29 Jul 2013 14:25:08 +0100, Paul Macdonald wrote: Hi, I spotted what i'd call an unusual file in the basejail on a jail install, and have since seen this on other non jailed boxes. -r-xr-xr-x 2 root wheel 11488 Jun 10 12:19 [ man [ reveals test, [ -- condition evaluation utility just checking thats all ok, and i've not been rooted! The [ program is the same as the test program. It's a valid file name and it's often used in shell scripts instead of test. % ll /bin/test /bin/\[ -r-xr-xr-x 2 root wheel 8336 2011-08-21 20:23:20 /bin/[* -r-xr-xr-x 2 root wheel 8336 2011-08-21 20:23:20 /bin/test* Consider shell scripts. When you have a script with something like if [ -f bla.txt ]; then ... some stuff ... fi it is the same as if test -f bla.txt; then ... some stuff ... fi It's also often being used like [ -x blah.sh ] do_something which is identical to calling test and acting upon the value of the return code. Nothing to worry here. YOu can _always_ counter-check by building /usr/src/bin/test from source and compare the resulting binary. Both /bin/[ and /bin/test are usually installed as hardlinks (two file names for one / for _the same_ file), as seen in the corresponding Makefile: LINKS= ${BINDIR}/test ${BINDIR}/[ So it's not _that_ unusual. ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Unusual file: /bin/[
On Mon, 29 Jul 2013 14:25:08 +0100 Paul Macdonald wrote: Hi, I spotted what i'd call an unusual file in the basejail on a jail install, and have since seen this on other non jailed boxes. -r-xr-xr-x 2 root wheel 11488 Jun 10 12:19 [ man [ reveals test, [ -- condition evaluation utility just checking thats all ok, and i've not been rooted! The idea was to make shell scripts more readable as you can have something like: if [ ${x} -gt 1 ] ... [ is a hard-link to /bin/test and the closing] ] is its last argument. In most modern shells its a builtin feature and /bin/[ isn't used. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Unusual file: /bin/[
On Mon, 29 Jul 2013 15:45:10 +0200 cpghost cpgh...@cordula.ws wrote: On 07/29/13 15:25, Paul Macdonald wrote: Hi, I spotted what i'd call an unusual file in the basejail on a jail install, and have since seen this on other non jailed boxes. -r-xr-xr-x 2 root wheel 11488 Jun 10 12:19 [ That's a perfectly valid UNIX program used in (bourne) shell programming. It has been part of BSD Unix for ages. And I really mean AGES! grin I recall someone deciding that /bin/[ looked iffy and deleted it from a FreeBSD 1.1.5.1 box busy serving connections to a bunch of dial up users. An amazing number of things stopped working. -- Steve O'Hara-Smith st...@sohara.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org