From the course: Linux: Bash Shell and Scripts
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using file descriptors, file redirection, pipes, and here documents - Linux Tutorial
From the course: Linux: Bash Shell and Scripts
Using file descriptors, file redirection, pipes, and here documents
- [Narrator] Redirection for files, input and output, and using pipes really demonstrate the power of many of the features of what you use in bash. Firstly you want to keep in mind that processes normally have three files open. Files zero, one, and two. Zero we call standard in, one we call standard out, and two we call standard error. So notice there's two places output can go. Standard output and standard error. And with redirection our pipes we can separate out those or combine those if we want. When we run a command and on the command line we use a greater than all by itself, we're telling the shell to redirect the standard output of that command into the specified file. If on the command we put a two greater than, and it's important there's no space allowed between the two and the greater than. The two greater than means we're redirecting file number two, which is standard error. So error messages would get redirected to the specified file. And if we use a less than, that means…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
The typeset and declare commands for variables5m 7s
-
(Locked)
Looping with for/while sequences and reading input14m 20s
-
(Locked)
Defining functions and using return and exit6m 29s
-
(Locked)
Using file descriptors, file redirection, pipes, and here documents16m 52s
-
(Locked)
Control-flow case statements and if-then-else with the test command10m 11s
-
(Locked)
Using arithmetic operators2m 27s
-
(Locked)
Challenges: Using local variables in functions, loops, and arithmetic2m 44s
-
(Locked)
Solutions: Using local variables in functions, loops, and arithmetic4m 2s
-
(Locked)
-
-
-