cryinkfly / Autodesk-Fusion-360-for-Linux

This is a project, where I give you a way to use Autodesk Fusion 360 on Linux!
https://github.com/cryinkfly/Fusion-360---Linux-Wine-Version-/wiki
MIT License
1.95k stars 121 forks source link

Shell command executed differently in a terminal and script! #247

Closed cryinkfly closed 1 month ago

cryinkfly commented 2 years ago

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

andrewazores commented 2 years ago

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 commented 2 years ago

^

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

and/or

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

Lord-Memester commented 2 years ago

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

gromain commented 2 years ago

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.