SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
lol really???? i would think that would be a part of bash and not a seperate binary file like the command `cd`.
Actually, it is a builtin, but is also available as an external. And '[' and '[[' are distinct - the first is a synonym for the older 'test' command and the second is a reserved word which doesn't do word splitting and pathname expansion 'on the words between the [[ and ]]', which can screw you up with the '[' builtin if you don't quote carefully.
But follow that by doing this:
/usr/bin/[ --help
and you'll get a different output.
On systems the '[' is a link to 'test'.
Most scripting relies on the internal capabilites of the shell to process conditons -which can include a whole range of functions which are also available as external programs: [, [[, test, true, false and also the handling of 'if' statements which is the same thing(0,1) and don't forget about && and ||.
Different shells handle (or not) these things their own way.
When you see code like this:
if [[ something else...
it's really like three ifs or three tests. But there is usually a reason for doing it one way or another -either with test, single bracket or double bracket. For instance this 'or' doesn't work with double brackets
using BASH.
This:
[ "test1" = "not" -o "test2" = "so" ]
this:
if test "test1" = "not" -o "test2" = "so" ; then
and this:
[[ "test1" = "not" ]] || [[ "test2" = "so" ]] &&
all will do mostly the same thing depending on what's being tested.
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
Quote:
Originally Posted by H_TeXMeX_H
lol, this is the second time someone has asked this. Yeah, it definitely looks suspicious ... but it's just like 'test', and part of bash.
It's been a lot more than twice! Anybody who looks into what's on his system (especially Slackers) will notice it and start wondering I remember thinking "who rooted my system " the day I saw it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.