Kamalakshi
Kamalakshi

Reputation: 7578

Triple input redirection symbol in bash script

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?

Upvotes: 1

Views: 204

Answers (1)

jeremy-denis
jeremy-denis

Reputation: 6878

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

Upvotes: 2

Related Questions