Walt Mankowski via plug on 30 May 2023 17:08:57 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] zsh: command not found:


On Tue, May 30, 2023 at 08:00:47PM -0400, Ronald P Guilmet via plug wrote:
> On Tue, May 30, 2023 at 7:06 PM Walt Mankowski via plug <
> plug@lists.phillylinux.org> wrote:
> 
> > On Tue, May 30, 2023 at 06:49:18PM -0400, Ronald P Guilmet via plug wrote:
> > > I've been having issues with my MacBook Pro executing scripts without
> > > having the absolute path.
> > >
> > > 1. The path /home/ron/bin has been added to the .zshrc, and can be
> > verified
> > > by echoing the $PATH variable.
> > > 2. The script is executable u+x myfile. Even tried 755
> > > 3. The file is a bash script with the proper shebang path to /bin/bash,
> > and
> > > the bash location is verified by 'which bash'.
> > >
> > > I can only execute with ./home/ron/bin/myfile
> > > I thought it might have been a zsh thing, but even going to 'exec bash',
> > I
> > > have the same issue 'bash: command not found: myfile'.
> > >
> > > The only way to execute the file, is to give the absolute path. It's not
> > > really a big deal, just trying to figure it out.
> >
> > Interesting. I have a few things to try:
> >
> > 1. What happens when you run `which myfile`?
> > 2. Does it only happen with scripts? If you compile hello_world.c and
> > put it in bin, can you execute that without a full path?
> >
> > > The other Mac oddity is why I am a part of a staff group, and not like
> > > Linux where I'm ron:ron for a home directory.
> >
> > macOS comes from BSD, which does things a little differently. That
> > said, I don't know if other BSDs default to the 'staff' group.
> >
> > Walt
> > ___________________________________________________________________________
> > Philadelphia Linux Users Group         --
> > http://www.phillylinux.org
> > Announcements -
> > http://lists.phillylinux.org/mailman/listinfo/plug-announce
> > General Discussion  --
> > http://lists.phillylinux.org/mailman/listinfo/plug
> >
> 
> 1. What happens when you run `which myfile`?
> file not found
> 
> 2. Does it only happen with scripts? If you compile hello_world.c and
> put it in bin, can you execute that without a full path?
> 
> No. I compiled a Hello World in C, and I can't run it without ./hello. If I
> copy the file into /usr/local/bin it works. Interesting for sure.

This suggests that your PATH is incorrect. How did you change it? If
you just said something like `PATH=$PATH:~/bin`, did you remember to
export it?
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug