/ /ユーザが入力できるかどうかをスクリプトはどうやって知ることができますか。 [完了] - bash、ユーザー入力

スクリプトは、ユーザーが入力できるかどうかをどのように知ることができますか? [closed] - bash、ユーザ入力

bashスクリプト(またはなんでも)の方法はありますかそれはヘッドレスで実行されているかどうかを判断できますか?ユーザーが入力できるかどうか知りたいのですが。可能であれば、私は彼らに何かを頼むつもりです。

回答:

回答№1は0

から マン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.