NITIKA KHATKAR
NITIKA KHATKAR

Reputation: 179

Even thought I have set the $PATH variable still command not found

I am using a Mac. The output of echo $PATH gives:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/amazon/bin

But when I run

chmod +x mwinit 

It gives me the following error:

chmod: mwinit: No such file or directory

What am I missing? I have been trying from a long time to fix it. Any help would be appreciated.

Upvotes: 0

Views: 3200

Answers (2)

first you have to know where your mwinit file is for this you might want to try to run a whereis mwinit.

then you can use the chmod command with the full path to mwinit or run the following instead :

chmod +x $(whereis -b mwinit | cut -d' ' -f2)

then you do hash -r to be ready to go !

(hash -r will reload your shell hash-table for the executable w/i your $PATH)

Upvotes: 1

gaige
gaige

Reputation: 17481

The PATH only gets you to the executable (chmod in this case), you still must either be in the directory containing the target (mwinit in this case), or you must use the full path. Otherwise chmod doesn't know where to find your file.

Upvotes: 0

Related Questions