Czy istnieje sposób na skrypt bash (lub cokolwiek innegojęzyk) może określić, czy jest uruchamiany w sposób bezgłowy? Chcę wiedzieć, czy użytkownik może wprowadzić, czy nie. Jeśli mogą, zapytam ich o coś.
Odpowiedzi:
0 dla odpowiedzi № 1Od man bash:
An interactive shell is one started without non-option arguments and without the -c option whose standard input and
error are both connected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and
$- includes i if bash is interactive, allowing a shell script or a startup file to test this state.