You are not logged in.

#1 2005-03-21 15:55:12

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

bash quiz

ok, I just came across the coolest thing ever... it's actually really inane, but I find it funny when you find out things like this.

so I give it to you in the form of a quiz:

tell me why

$ if test -f /etc/rc.conf

and

$ if [ -f /etc/rc.conf]

are 100% identical.

I'll give you a hint: the only bash builtin is the "if"

Offline

#2 2005-03-21 16:07:10

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Re: bash quiz

isnt '[' is linked to 'test' thus its actually same thing? i am no bash coder so....

Offline

#3 2005-03-21 16:31:23

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: bash quiz

yup... it's funny that "[" is a symlink to test.... I saw that file sitting there today...

Offline

#4 2005-03-21 16:41:54

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: bash quiz

I thought this was well known. :-P

How come you have more posts than me? mad

Offline

#5 2005-03-21 17:02:09

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: bash quiz

Dusty wrote:

I thought this was well known. :-P

How come you have more posts than me? mad

maybe everyone knew but me....

aha! I'm winning... wow, I have alot of posts... *sigh* I'm a loser  :oops:

Offline

#6 2005-03-21 17:31:21

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Offline

#7 2005-03-22 12:22:02

zezaz
Member
From: Bordeaux, France
Registered: 2004-04-26
Posts: 80
Website

Re: bash quiz

actually [ and test are bash builtins smile

 # type test
test is a shell builtin

but /usr/bin/test and /usr/bin/[ may be used if you rely on another simpler shell (ash, ...)

Offline

Board footer

Powered by FluxBB