Autodesk-Fusion-360-for-Linux icon indicating copy to clipboard operation
Autodesk-Fusion-360-for-Linux copied to clipboard

Shell command executed differently in a terminal and script!

Open cryinkfly opened this issue 2 years ago • 4 comments

I may have found another reason for the different results, why the installation works for one and not for the other.

If you look at the examples and explanation in the page linked below, you can see why.

So please check it out: https://unix.stackexchange.com/questions/464770/shell-command-executed-differently-in-a-terminal-and-script


Bildschirmfoto_2022-06-22_14-11-51

cryinkfly avatar Jun 22 '22 12:06 cryinkfly

Worth looking into https://github.com/koalaman/shellcheck .

You could also set this up for CI on each PR using GitHub Actions/workflows to ensure that all accepted code contributions are properly portable across shells, and therefore (hopefully) portable across distros.

andrewazores avatar Jul 05 '22 00:07 andrewazores

^

https://github.com/marketplace/actions/run-shellcheck-with-reviewdog

and/or

https://github.com/marketplace/actions/shellcheck

andrewazores avatar Jul 05 '22 00:07 andrewazores

But... which one does and which one doesn't it work in?

Lord-Memester avatar Jul 06 '22 17:07 Lord-Memester

This shouldn't be an issue, the terminal and the launcher should be respecting the shebang (#!/bin/bash) at the beginning of the files. However, I just learned that when using source to launch a script, some shells (zsh mainly) don't.

This answer is more likely to provide more explanation: https://unix.stackexchange.com/questions/580124/does-zsh-respect-the-shebang-bin-sh-so-dash-can-be-used

I think that if we want to use bash, the launch command line should be changed to bash ./install.sh instead of ./install.sh.

gromain avatar Aug 31 '22 13:08 gromain