Artificial intelligent assistant

Question about interactive detection in bash I have a question about interactive detection in bash. The following script prints if it is called in interactive mode or not. $ cat int.sh #!/bin/bash if [ -t 0 ]; then echo "interactive" else echo "not interactive" fi Some call examples... $ ./int.sh interactive $ echo toto | ./int.sh not interactive $ ./int.sh < ./int.sh not interactive $ ./int.sh <<EOF > hello world! > EOF not interactive But why the result is interactive for the following case ? $ ./int.sh <( cat ./int.sh ) interactive

The `<(...)` statement in bash is process substitution. The process in `<(...)` is run with its input or output connected to a FIFO or some file in `/dev/fd`. See it with:


echo <(echo foo)


It prints something like `/dev/fd/63`. That is the file descritor. The `<(...)` part is then replaced with that file descriptor. So in your statement the call would be for example:


./int.sh <( cat ./int.sh )


Is replaced with:


./int.sh /dev/fd/63


So, it's just an argument to the script `./int.sh`, that is still called interactively.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a604c4ce7eecc576819ec1d2194b16ad