Hi Christian

On 11/27/24 4:27 PM, [email protected] wrote:
Hello Hakan,

thank you for the reply.

Am 27.11.2024 13:55 schrieb Hakan Bayındır:
Most of the Linux distributions ship dash which is basically "sh" of this era.

If our scripts can conform to sh, I think we can alleviate most if not
all the problem related to this.

Converting the scripts shouldn't be hard. "shellcheck -s sh $FILE" would do.

Most of it are inline shell code used with ssh all around in several py files.

But it is not only about which shell syntax we use. It is about to force that shell on the remote server.
It won't help to have dash/sh code if fish is running on the remote host.

You're right. However dash is generally a "system shell", so it's mostly bundled to run the system tasks (cron, boot processes, commands called by init system, etc.) so, user might be logging into a fish environment, but we shall have dash 99% of the time.

So, it becomes a matter of switching to that shell. I don't know the commands in the source code (sorry for my laziness), but calling a command with "sh -c" allows us to run any command via dash and return back (e.g.: sh -c "echo Hello World!").

Maybe we can verify that we have bash or dash via checking where /bin/sh points and call the commands via "sh -c" explicitly to force our environment.

Running "sh -c" looks like the environment is also inherited into the current session, so we can operate like nothing happened.

Hope this is useful for you,

Cheers,

Hakan


Regards,
Christian
_______________________________________________
Bit-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/bit-dev.python.org/
Member address: [email protected]

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Bit-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/bit-dev.python.org/
Member address: [email protected]

Reply via email to