Linux Input Redirection< stdin The bash shell uses stdin to take input. In input redirection, a file is made input to the command and this redirection is done with the help of '<' sign. Syntax: Example: Look at the above snapshot, command "cat < file.txt" has taken 'file.txt' as input and displayed its content. << here documentThe here document (sometimes also called here-is-document) is a way in which you can enter input until a certain sequence(usually EOF) is typed. The EOF (End Of File) can be typed or can be called by pressing (ctrl + d) keys. Any word can be used in place of 'EOF' like we have used 'last'. Syntax: Example: Look at the above snapshot, in first example, 'file.txt' is ended when we typed 'EOF' and 'last' in second example. <<< here string The here string is used to directly pass strings to a command. Example: Look at the above snapshot, in this example we have used base64 which we'll study later. Command "base64 <<< format.txt" has decoded file 'format.txt' and then by using command 'base64 -d' we got back our file 'format.txt'. Next TopicLinux Output Redirection |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India