I saw a code like this that could be run on the bash prompt: bc fibonacci.bc <<< "fibonacci(1)"
A function fibonacci(n)is defined in the file fibonacci.bc. The syntax of the function follows bc syntax rules.
The redirection symbol <<< looks new to me. Can somebody throw some light on it?
1 Answer
The <<< symbol is used to pass a string as the standard input of the command used.
It's called a here-string.
The simplest example is with cat:
cat <<< 'hello'
You can find a first explanation in the man bash page https://www.gnu.org/software/bash/manual/html_node/Redirections.html#Here-Strings
4 Comments
tripleee
I would generally be hesitant to link to the ABS.
jeremy-denis
ok i edit the link by link to online bash man page
tripleee
gnu.org/s/bash/manual might be a better link, it has HTML sections you can link to.
jeremy-denis
thank you for your feedback i edit the link with gnu.org/software/bash/manual/html_node/…
<<<. The first hit will be a small section titled Here Strings which explains everything about this operator.