COMMAND_LINE -> Return code 1 -> running bash

Good day,
Thank you for reading my post. I appreciate your feedback. I just started with HA and have minimal knowledge of Linux. OpenAI helps a lot, but cannot solve this issue. So, show me that you know more than OpenAI :grimacing:

The below is a test and doesn’t entail my goal. My goal is to retrieve the temperature from an external Raspberry Pi4 without using a password. I am able to connect to the Rpi4 in the CLI using a fingerprint.

What works is:
CONFIGURATION.YAML

  - sensor:
      name: nc_temp
      command: "echo "test"
      scan_interval: 5

What doesn’t work:
CONFIGURATION.YAML

  - sensor:
      name: nc_temp
      command: "'bash -s' < /home/ramin/temp/temp_nextcloud.sh"
      scan_interval: 5

HOME-ASSISTANT.LOG

2023-07-17 12:47:08.232 ERROR (SyncWorker_4) [homeassistant.components.command_line.utils] Command failed (with return code 1): 'bash -s' < /home/ramin/temp/temp_nextcloud.sh

temp_nextcloud.sh entails:

config # cat /home/ramin/temp/temp_nextcloud.sh
echo 'Testing'
config #

file_rights:

config # ls -laF /home/ramin
total 24
drwxr-sr-x    3 ramin    ramin         4096 Jul 17 12:04 ./
drwxr-xr-x    1 root     root          4096 Jul 15 13:17 ../
-rw-r--r--    1 root     ramin           13 Jul 15 13:17 .profile
drwxrwxrwx    2 ramin    ramin         4096 Jul 17 12:05 temp/
-rwxr-xr-x    1 root     ramin           28 Jul 17 11:42 temp_nextcloud.copy.sh*
-rwxr-xr-x    1 ramin    ramin           17 Jul 17 11:43 temp_nextcloud.sh*

config # ls -laF /home/ramin/temp
total 12
drwxrwxrwx    2 ramin    ramin         4096 Jul 17 12:05 ./
drwxr-sr-x    3 ramin    ramin         4096 Jul 17 12:04 ../
-rwxrwxrwx    1 ramin    ramin           15 Jul 17 12:55 temp_nextcloud.sh*
config #

I know the rights are overdone, but to test I wanted to be sure file-rights are no issue.

Why the error and isn’t the command_line executed?

I would not have thought either of these would work because of the improper use of quotes:

command: "echo "test"
command: "'bash -s' < /home/ramin/temp/temp_nextcloud.sh"

Shouldn’t they be like this:

command: "echo 'test'"
command: "bash -s < /home/ramin/temp/temp_nextcloud.sh"