Penguin
Note: You are viewing an old revision of this page. View the current version.

Here Strings

A variant of here documents, the format is:

  • command <<< "string"

A here string uses a form of I/O redirection to feed a command to an interactive program or a command, such as ftp, cat, ex or read. This can be extremely handy.

I find Here String's very useful to easily assign values to multiple variables.

For Example:

  • IFS=: ; read foo bar moo <<< "yellow:red:blue";

Now try:

  • echo $foo $bar $moo

and hopefully the value of the three variables will be displayed for you.