0

For testing and learning purposes I have made a copy of raspi-config file. i can see it in directory and can open it for editing. However, after saving it with different name I cannot execute it using this command:

pi@pi:/ $ sudo raspi-config.test

and getting this reply :

sudo: raspi-config.test: command not found

This is my first attempt to make a copy of Linux file.

Did I missed something to make the file executable?

I have no issues running the original using same command sudo file-name

3

In linux it is a "security" issue that you cannot execute scripts and programs in the current directory by default. To do that you must precede the script with ./ (dot+slash) so your call should look like this:

rpi ~$ sudo ./raspi-config.text

It may also be required to make the script executable with

rpi ~$ sudo chmod ugo+x raspi-config.text

Btw.: It doesn't matter but for convention it is better to name your shell script raspi-config.sh.

  • Point taken as far as .sh "suffix" – Jan Hus Aug 3 '18 at 22:23
  • OK I cannot accept my own answer, so how to close / mark solved the issue? – Jan Hus Aug 4 '18 at 0:15
  • With the accepted answer the question is solved. – Ingo Aug 4 '18 at 0:27
0

I need to use chmod +x to be able to execute the new file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.