Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by eyepopslikeamosquito (Bishop)
on Aug 21, 2020 at 22:38 UTC ( #11120982=note: print w/replies, xml ) Need Help??


in reply to Re^2:[OT] 'perl' is not the 'perl' reported by 'which perl'
in thread [OT] 'perl' is not the 'perl' reported by 'which perl'

This link might be useful for the OP, especially the type command

Ha ha, over twenty years ago I was ordered by our Unix guru at work to never use the C shell and to "always use the type command, never the which command". Being frightened of our Unix guru, I've always followed that advice ... but been surprised many times over the years by folks looking over my shoulder asking "what is the type command?" - my experience has been that most people use the which command and have never even heard of the type command! ... perhaps showing the importance of a descriptive name.

See also:

Replies are listed 'Best First'.
Re^4: [OT] 'perl' is not the 'perl' reported by 'which perl'
by kcott (Bishop) on Aug 22, 2020 at 01:55 UTC
    "... 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

Re^4: [OT] 'perl' is not the 'perl' reported by 'which perl'
by trippledubs (Deacon) on Aug 24, 2020 at 01:39 UTC

    I've been an SA for like 10 years and never knew that until now. When I think type, I think DOS / windows cat command. Seems to still work in powershell:

    PS C:\Users\Dubs> get-Command type,cat,where,gm,help,get-help CommandType Name Version Source ----------- ---- ------- ------ Alias type -> Get-Content Alias cat -> Get-Content Alias where -> Where-Object Alias gm -> Get-Member Function help Cmdlet Get-Help 3.0.0.0 Microsoft.PowerSh +ell.Core

    Looks like zsh and csh alias to whence -v.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2020-11-23 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?