What is the exclamation mark at the beginning of a line in this BASH fragment?

I understand the history extension in C-shell and BASH, but I don’t understand why the exclamation mark in the command line is readused in this fragment from some source that I look at:

#!/bin/bash

set -e

. "$(dirname "$0")/includes.sh"

! read -d '' SOME_VAR <<"EOT"
  some ASCII art
EOT

echo -e "\033[95m$SOME_VAR\033[0m"

Why do you deny the return value of the command read(I think this is its effect, not an extension of the story)? Are there any possible error conditions besides running out of memory? The only thing I can think of would be EINTRthat, I think, it would be an interruption condition ( SIGINTor SIGHUP). And why do you specify the start marker heredoc( EOT) twice rather than the end marker?

, , , .

+4
1

set -e bash , ( , ).

! , set -e. , , . !, , ( ).

bash:

, , , "" "", "if", , '& &' '||' , && '||', , , ​​ "!".

https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html

( , ! .)

read -

, , read ( 128), , -u.

- . read <<EOT ( -d '') , read , . ! script ( - $SOME_VAR).

+6

Source: https://habr.com/ru/post/1694946/


All Articles