You are not logged in.

#1 2020-02-22 20:59:45

plutoG
Banned
Registered: 2020-02-22
Posts: 26

[SOLVED] Custom $PATH to home/user_name/bin Not Working

EDIT:
Right after writing this post I figured out that I was trying to run the script the wrong way.


./netstat.sh

I guess is not the proper command????

Because when I do

netstat.sh

It works perfectly.

Sorry to waste anyones time but I figured that leaving this up may help someone else in the future.
I will research what the difference makes in the commands.



I have been for what seems like forever trying to setup a bin folder in my home directory for my personal scripts and can not get it to work(on any distro I have tried it one actually)

(the **** in the following commands represents my user name on the machine which I feel is irrelevant)

For starts I imagine one might want to see this first

uname -a
Linux arch 5.5.5-zen1-1-zen #1 ZEN SMP PREEMPT Thu, 20 Feb 2020 18:22:57 +0000 x86_64 GNU/Linux

and also

Output of $PATH

bash: /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl://home/****/bin: No such file or directory


What I have done is:

For reference the source of the method I used is

Trying to do what is mentioned in the Per User section,
I used the following commands in my terminal

I added

export PATH="${PATH}:/home/****/bin"

to my users bash_profile like it tells me to.

And then both both re logging in and also(because neither helped)

source ~/.bash_profile

Even as a last ditch effort rebooted the machine.

Still did not let me run my script that is in the bin directory that is inside my users home directory using

./netstat.sh

And I get the following output

./netstat.sh
bash: ./netstat.sh: No such file or directory

Which is just a simple script that runs

ss -atun

and refreshes every 15 seconds to show connections to the machine.

My script for reference just in case it helps or anyone is just plain curious.

#!/bin/bash

while true

do

ss -atun

sleep 15

clear

done

Runs exactly like it is supposed to when I call(is that the proper wording?) the path to it.

/home/****/bin/./netstat.sh

It is named netstat because I used to use net-tools instead of iputils(I think I named the package correctly)

Thank you to anyone that tries to help.

Last edited by plutoG (2020-02-22 21:27:45)

Offline

#2 2020-02-22 21:06:16

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,396

Re: [SOLVED] Custom $PATH to home/user_name/bin Not Working

Calling anything with ./ will not invoke a PATH lookup.  "." is your current local directory. If you want your PATH to be checked use just

netstat.sh

It's also weird that according to the path echo there seems to be a random stray / somewhere, but it shouldn't inherently matter.

Last edited by V1del (2020-02-22 21:10:46)

Offline

#3 2020-02-22 21:11:24

plutoG
Banned
Registered: 2020-02-22
Posts: 26

Re: [SOLVED] Custom $PATH to home/user_name/bin Not Working

I see what the problem was now thank you for the information.

Last edited by plutoG (2020-02-27 08:38:56)

Offline

#4 2020-02-22 21:13:08

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,396

Re: [SOLVED] Custom $PATH to home/user_name/bin Not Working

Please mark as [SOLVED] by editing the title in your first post: https://wiki.archlinux.org/index.php/Co … ow_to_post

Offline

#5 2020-02-22 21:27:04

plutoG
Banned
Registered: 2020-02-22
Posts: 26

Re: [SOLVED] Custom $PATH to home/user_name/bin Not Working

V1del wrote:

Please mark as [SOLVED] by editing the title in your first post: https://wiki.archlinux.org/index.php/Co … ow_to_post

Sorry about that I forgot.


EDIT:

@V1del

V1del wrote:

Calling anything with ./ will not invoke a PATH lookup.  "." is your current local directory. If you want your PATH to be checked use just

netstat.sh

It's also weird that according to the path echo there seems to be a random stray / somewhere, but it shouldn't inherently matter.

Somehow it went away when I did it over again to try and figure out why this was the case.
More likely than not I had the command typed wrong which i tend to do a lot because I try to type too fast.

And again thank you very much for the help.

Last edited by plutoG (2020-02-27 08:39:09)

Offline

Board footer

Powered by FluxBB