0

sorry for the beginner's question, but I'm a bit stuck.

Debian Buster on an OrangePi Zero+

from root # echo "6" > /sys/class/gpio/export works fine as root

the same line in an bash script executed as root fails w/ Permission denied

The script is owner:root mod is 2777

From user Level $ sudo echo "6" > /sys/class/gpio/export fails as well

I need to execute this statement w/in a shell script (can be root)! so what can I do?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
hans
  • 139
  • 4
  • There's an existing question: [How do I use sudo to redirect output to a location I don't have permission to write to?](/q/82256/4518341) Does that solve the problem? If not, I don't know why the script would fail. Please make a [mre] including the script and how you're calling it. – wjandrea Feb 05 '22 at 19:46

1 Answers1

0

The culprit was found in CR/LF, imported from Windows. That's why it worked at cmd level and not in the script.

hans
  • 139
  • 4