Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: [OT] 'perl' is not the 'perl' reported by 'which perl'

by kcott (Archbishop)
on Aug 22, 2020 at 01:55 UTC ( [id://11120983]=note: print w/replies, xml ) Need Help??


in reply to Re^3: [OT] 'perl' is not the 'perl' reported by 'which perl' (which vs type References)
in thread [OT] 'perl' is not the 'perl' reported by 'which perl'

"... most people use the which command and have never even heard of the type command! ..."

That's very interesting. I've used quite an array of shells since the '80s (sh, ksh, bash, csh, tcsh, and others). I'm reasonably certain I've used which almost exclusively. I couldn't definitely say I've never heard of type but, had I been asked about it yesterday, I would have had to look it up. I decided to look into this a bit further.

There appears to be some redundant information (<some-command> is) with type; however, in isolation that doesn't appear to be a problem.

$ which perl /.../perl $ type perl perl is /.../perl

I did encounter an issue in this scenario:

$ ls -l `which perl` -rwxr-xr-x 2 ken None 169225 Jun 23 20:35 /.../perl $ ls -l `type perl` ls: cannot access 'perl': No such file or directory ls: cannot access 'is': No such file or directory -rwxr-xr-x 2 ken None 169225 Jun 23 20:35 /.../perl

On the other hand, it's particularly useful here:

$ which perle which: no perle in (...) $ type perle perle is aliased to `perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::A +lways -E'

So, it looks like both commands have their uses in different situations. I will remember type from now on and use it where needed. Thanks for pointing out this command. [Edit: Actually, it looks like LanX was the first to mention type, so thanks Rolf.]

[In case anyone was wondering, the /.../perl represents identical pathnames throughout. With "perlbrew", those paths are long and would probably wrap.]

— Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120983]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2025-11-08 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (65 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.