0

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.

NITIKA KHATKAR
  • 149
  • 2
  • 4
  • 15

2 Answers2

1

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)

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/25841976) – Midiparse Apr 12 '20 at 22:35
  • well if a program is not executable a "which prog" won't locate it, while a whereis might, this location information required to fix the problem, other solution doesn't provide a mean to know where the "target" is. – Michel C. a.k.a Doctor I-T Apr 13 '20 at 09:01
  • Yes you are absolutely right. Thanks for extending it, so it provides a full answer. – Midiparse Apr 13 '20 at 12:42
0

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.

gaige
  • 17,263
  • 6
  • 57
  • 68