EXCELLENT work, Frank, and THANKS for sharing your findings.

I say you've found a BASH bug.
I can IMAGINE how/why BASH is failing on external links, but it doesn't matter. The point is: IT FAILS and it should not.
Great catch!

I'd be happy to help chase down a resolution, if we can simply get BASH developers (and/or those porting it to z/OS) to join in.

More in a follow-up note.

-- R; <><


On 2/19/24 14:50, Frank Swarbrick wrote:
If you are referring to the setting of $PATH during logon, or just invoking a 
shell, my PATH includes the directory in which both netstat and onetstat reside 
(/bin).  See the following tests:


(base) [bash] DVFJS@ZOSD ~ $ printenv PATH

/u/dvfjs/golang/bin:/u/dvfjs/miniconda/bin:/u/dvfjs/miniconda/condabin:/u/dvfjs/bin:/bin:/usr/sbin:/usr/lpp/java/J8.0_64/bin:/_PRDS/PYTHON/SCYPH311/pyz/bin:.

(base) [bash] DVFJS@ZOSD ~ $ printenv SHELL

/u/dvfjs/miniconda/bin/bash

(base) [bash] DVFJS@ZOSD ~ $ onetstat -P 1234

MVS TCP/IP NETSTAT CS V2R5       TCPIP Name: TCPIP           12:21:49

User Id  Conn     Local Socket           Foreign Socket         State

-------  ----     ------------           --------------         -----

CICSDEVD 0016A155 0.0.0.0..1234          0.0.0.0..0             Listen

(base) [bash] DVFJS@ZOSD ~ $ which onetstat

/bin/onetstat

(base) [bash] DVFJS@ZOSD ~ $ netstat -P 1234

bash: netstat: command not found

(base) [bash] DVFJS@ZOSD ~ $ which netstat

which: no netstat in 
(/u/dvfjs/golang/bin:/u/dvfjs/miniconda/bin:/u/dvfjs/miniconda/condabin:/u/dvfjs/bin:/bin:/usr/sbin:/usr/lpp/java/J8.0_64/bin:/_PRDS/PYTHON/SCYPH311/pyz/bin:.)


[Note that the ls -F option "Puts a / after each directory name, a * after every 
executable file, a | after every FIFO file, a @ after every symbolic link, and a = after 
every socket. It also puts an & character after an external link name."]

(base) [bash] DVFJS@ZOSD ~ $ ls -Fl /bin/netstat /bin/onetstat

erwxrwxrwx   1 BPXROOT  OMVSGRP        8 Jun  1  2021 /bin/netstat& -> ONETSTAT

lrwxrwxrwx   1 BPXROOT  OMVSGRP       29 Jun  1  2021 /bin/onetstat@ -> 
../usr/lpp/tcpip/bin/onetstat

(base) [bash] DVFJS@ZOSD ~ $ ls -Fl /bin/ | grep '&'

erwxrwxrwx   1 BPXROOT  OMVSGRP        8 Jun  1  2021 ezbzcmcs& -> EZBZCMCS

erwxrwxrwx   1 BPXROOT  OMVSGRP        8 Jun  1  2021 makedepend& -> CCNEMDEP

erwxrwxrwx   1 BPXROOT  OMVSGRP        8 Jun  1  2021 netstat& -> ONETSTAT

erwxrwxrwx   1 BPXROOT  OMVSGRP        5 Jun  1  2021 ping& -> OPING

erwxrwxrwx   1 BPXROOT  OMVSGRP        8 Jun  1  2021 portmap& -> OPORTMAP

erwxrwxrwx   1 BPXROOT  OMVSGRP        6 Jun  1  2021 rexec& -> OREXEC

erwxrwxrwx   1 BPXROOT  OMVSGRP        7 Jun  1  2021 rpcgen& -> ORPCGEN

erwxrwxrwx   1 BPXROOT  OMVSGRP        8 Jun  1  2021 rpcinfo& -> ORPCINFO

erwxrwxrwx   1 BPXROOT  OMVSGRP        4 Jun  1  2021 rsh& -> ORSH

erwxrwxrwx   1 BPXROOT  OMVSGRP        5 Jun  1  2021 snmp& -> OSNMP

erwxrwxrwx   1 BPXROOT  OMVSGRP        6 Jun  1  2021 sosinfo& -> CDASOS

erwxrwxrwx   1 BPXROOT  OMVSGRP        8 Jun  1  2021 traceroute& -> OTRACERT

(base) [bash] DVFJS@ZOSD ~ $ ping

bash: ping: command not found

(base) [bash] DVFJS@ZOSD ~ $ rpcinfo

bash: rpcinfo: command not found

(base) [bash] DVFJS@ZOSD ~ $ sosinfo

bash: sosinfo: command not found

(base) [bash] DVFJS@ZOSD ~ $ traceroute

bash: traceroute: command not found

(base) [bash] DVFJS@ZOSD ~ $ /bin/netstat -P 1234

MVS TCP/IP NETSTAT CS V2R5       TCPIP Name: TCPIP           12:47:43

User Id  Conn     Local Socket           Foreign Socket         State

-------  ----     ------------           --------------         -----

CICSDEVD 0016A155 0.0.0.0..1234          0.0.0.0..0             Listen


Thus my "guess" that in bash (but not in sh or tcsh) the file names that are 
external links are not found (unless the directory is explicitly specified.

Try it yourself (if you have bash available).

________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of Rick 
Troth <0000058ff5c2d0a7-dmarc-requ...@listserv.ua.edu>
Sent: Monday, February 19, 2024 6:50 AM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: Re: zsh for z/OS

Check your PATH environment variable.
If the directory where 'netstat' resides is not in your PATH, then
you'll get "command not found".
There's nothing about BASH or ZSH which would preclude 'netstat' or
'onetstat' from working.

One of the [un]fortunate things about the myriad command shells
available is that most have their own unique way of profiling. (Though
most *can* follow the original rules.)
That is, if you have $HOME/.bash_profile, and BASH is your login shell,
it will get sourced when you log-on rather than $HOME/.profile.
You very possibly have different profiling for BASH, ZSH, and stock
/bin/sh.
As a rule, I either remove $HOME/.bash_profile or make it a sym-link to
$HOME/.profile.

I do use ZSH, but less often, so am less familiar with how it works on
this point.

ORIGINALLY, /etc/profile gets sourced when you log-on. If you then also
have $HOME/.profile, it gets sourced afterward (so you can override
system profiling with your own customizations).

A related thing is "RC files", like $HOME/.bashrc. The "RC files" get
sourced *every* time a shell is spawned, not just when you log-on.
Many newcomers to Unix/Linux/POSIX don't know the difference between the
profiles and the RC files, so they throw all of the profiling into
(e.g.) $HOME/.bashrc. It's kinda counter-productive. The RC files are
for settings which cannot be "inherited" for one reason or another.

It gets worse with graphical logon. (But need not! Just that nobody
bothered to set things right for the graphical logon logic.)

Keep it simple and stick with the standards. Avoid shiny things and
feechers which cause konfoozhun.

-- R; <><


On 2/16/24 15:48, Michael Babcock wrote:
According to the man page for netstat, it’s a synonym for onetstat.
Issuing netstat in bash 5.2 says command not found.   It may be a moot
point if it’s truly a synonym.

On Fri, Feb 16, 2024 at 2:33 PM Frank Swarbrick <frank.swarbr...@outlook.com>
wrote:

Here's a bit of an off the wall question/request.

Do both 'netstat' and 'onetstat' work in zsh?

In bash, only 'onetstat' works.  I think that bash under z/OS is unable to
follow executables with the 'e' file type (external link).


ls -FalTHp /bin/netstat /bin/onetstat

                      erwxrwxrwx         1 BPXROOT  OMVSGRP        8 Jun  1
2021 /bin/netstat -> ONETSTAT

                      lrwxrwxrwx         1 BPXROOT  OMVSGRP       29 Jun  1
2021 /bin/onetstat -> ../usr/lpp/tcpip/bin/onetstat

Frank

________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf
of Ed Jaffe <000005acc3c79bf7-dmarc-requ...@listserv.ua.edu>
Sent: Friday, February 16, 2024 12:48 PM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: Re: zsh for z/OS

On 2/16/2024 11:33 AM, Frank Swarbrick wrote:
z/OS 3.1 added the Z Shell, zsh.  Is anyone using it?  How do you like
it.  What interesting features does it have over bash?
I'm only at 2.5, so can't use it.
I am using it. After all, what self-respecting z/OS advocate doesn't
want to use a shell called Z?

I'm not a power user. Not doing anything I couldn't also do in bash...

--
Phoenix Software International
Edward E. Jaffe
831 Parkview Drive North
El Segundo, CA 90245
https://www.phoenixsoftware.com/



--------------------------------------------------------------------------------
This e-mail message, including any attachments, appended messages and the
information contained therein, is for the sole use of the intended
recipient(s). If you are not an intended recipient or have otherwise
received this email message in error, any use, dissemination, distribution,
review, storage or copying of this e-mail message and the information
contained therein is strictly prohibited. If you are not an intended
recipient, please contact the sender by reply e-mail and destroy all copies
of this email message and do not otherwise utilize or retain this email
message or any or all of the information contained therein. Although this
email message and any attachments or appended messages are believed to be
free of any virus or other defect that might affect any computer system
into
which it is received and opened, it is the responsibility of the recipient
to ensure that it is virus free and no responsibility is accepted by the
sender for any loss or damage arising in any way from its opening or use.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to