LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 01-29-2007, 08:16 AM   #1
ia64processor
Member
 
Registered: Sep 2003
Location: Tokyo
Distribution: Red Hat
Posts: 41

Rep: Reputation: 15
What is this file: /usr/bin/[


ls -al /usr/bin/[
-rwxr-xr-x 1 root root 31048 Jan 11 00:06 /usr/bin/[


This file can also be found in FC5 as well. Just curious...
 
Old 01-29-2007, 08:44 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
It is executable similar or identical to 'test' executable. It is invoked when you use constructs like 'if [ -f file ]; then echo yes; fi;'. Here '[' is just a command name, not a special syntax character.
 
Old 01-29-2007, 08:48 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Raskin told that! As a proof you can safely do
Code:
/usr/bin/[ --help
 
Old 01-29-2007, 09:07 AM   #4
Nick_Battle
Member
 
Registered: Dec 2006
Location: Bracknell, UK
Distribution: SUSE 13.1
Posts: 159

Rep: Reputation: 33
Strictly, I think that command only exists for use by shells where the "[" command isn't a shell builtin - eg. in bash, writing "if [ ..." doesn't run the /usr/bin/[ program, but other shells might need it.

bash-2.03$ type [
[ is a shell builtin
bash-2.03$
 
Old 01-29-2007, 09:17 AM   #5
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
I would add that it is so in bash invoked as bash, and not /bin/sh which often links to /bin/bash. And it can be used not only by shells, but also by any other programs... I am not sure if POSIX requires providing executable capable to handle 'test' invocation.
 
Old 02-04-2007, 03:17 AM   #6
ia64processor
Member
 
Registered: Sep 2003
Location: Tokyo
Distribution: Red Hat
Posts: 41

Original Poster
Rep: Reputation: 15
Thank you all gentlemen!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file /usr/bin/mysqlbug from install of mysql-3.23.58-1.9 conflicts with file from pac commandline Linux - Software 2 09-28-2006 06:55 PM
Installing .bin-files, leave the file in /usr/local/bin/ ? lagu2653 Linux - Software 1 11-08-2005 09:30 PM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 02:02 AM
bin/bash:usr/bin/lpr NO SUCH FILE OR DIRECTORY Adibe_Hamm Linux - Newbie 3 10-14-2003 03:30 AM
/usr/bin file permissions enlight1 Linux - Newbie 2 07-31-2003 09:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 10:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration