Bash - is this called a definition? -
i'm pretty new bash,
i learned using variables this:
var=$(cat << eof echoed , well... eof ) echo "$var"
if above code called using variable
how call approach below? called using definition
?
def="this should echoed\nand well...\n" printf "$def"
i'm asking right terminology of second approach.
both var
, def
variables; is, names of string-data in current environment, accessed using $
in examples.
to create each variable, assign string it. called assignment. syntactically, =
assignment operator.
once var
, def
assigned, there no difference in how store data; stored data in each case merely string.
there nothing "special" requiring additional terminology in assignment of def
. however, there 2 interesting aspects of var
assignment:
- as alluded in comment, use of
cat
pattern called "here document". - to create , capture "document" (which string), using
$()
, form of "command substitution".
Comments
Post a Comment