1

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?

2
  • 2
    Reading your question, I think you may be interested by reading This answer to Is bash a programming language? Commented Mar 14, 2024 at 7:52
  • 2
    Do a man bash and search for <<<. The first hit will be a small section titled Here Strings which explains everything about this operator. Commented Mar 14, 2024 at 8:07

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

4 Comments

I would generally be hesitant to link to the ABS.
ok i edit the link by link to online bash man page
gnu.org/s/bash/manual might be a better link, it has HTML sections you can link to.
thank you for your feedback i edit the link with gnu.org/software/bash/manual/html_node/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.