Open barbayjuliette opened 10 months ago
Several redirections: INPUT: ex: grep hello < file1 < file2 < file3 Tries to open all the files, if any of the files doesn't exist -> error Takes only last one as input. ex: _grep hello < file1 << DELIM < file3 Similar, it will still ask me to write the heredoc, but will use file3 as input
OUTPUT ex; echo hello > file1 >> file2 > file3 For each file, if the file does not exist, it will create it. If the file exists, replaces it with empty file ( if >) or do nothing (if >>) Uses that last one for output
echo hello << DELIM --> Even if no input needed we need to process redirection. Here we will still get the HEREDOC
HEREDOC:
Check example here: https://linuxize.com/post/bash-heredoc/
hello AB hello CD EF bash-3.2$ --> Doesn't echo anything since no hello in the last one
grep hello << AB << CD << EF < infile -> Will still give the HEREDOC? even if it is not needed
mplement redirections: ◦ < should redirect input. ◦ > should redirect output. ◦ << should be given a delimiter, then read the input until a line containing the delimiter is seen. However, it doesn’t have to update the history! ◦ >> should redirect output in append mode