diff --git a/Programming_Languages/Shell/Redirect_to_dev_null.md b/Programming_Languages/Shell/Redirect_to_dev_null.md index 4a8d6af..3d31fd7 100644 --- a/Programming_Languages/Shell/Redirect_to_dev_null.md +++ b/Programming_Languages/Shell/Redirect_to_dev_null.md @@ -18,6 +18,12 @@ This is a redirection statement. It is redirecting data to the `null` device on The `2>&1` argument is the content: any errors that the program may generate and try to show in stout. Notice we are using the [file descriptors](/Programming_Languages/Shell/File_descriptors_and_redirection.md) `1` and `2`. +If you just want the errors regardless of whether they appear in `stdout` you do: + +```bash +[some_command] > /dev/null 2> +``` + ## Example I have used this in my Mongo start-up script: diff --git a/Programming_Languages/Shell/Redirection.md b/Programming_Languages/Shell/Redirection.md index 4b1f8bc..e784072 100644 --- a/Programming_Languages/Shell/Redirection.md +++ b/Programming_Languages/Shell/Redirection.md @@ -21,6 +21,12 @@ It is common practice to combine redirection with the [file descriptors](/Progra ## Redirecting inputs +We can also switch the direction of the redirection symbol and pass in a file to a command rather than command ouput to a file: + +```bash +sql-processing-program < data.sql +``` + ## Appending We use `>>` to append contents on the next available line of a pre-existing file. Continuing on from the example above: diff --git a/_scripts/random_revision_topic.sh b/_scripts/random_revision_topic.sh new file mode 100644 index 0000000..85e97d6 --- /dev/null +++ b/_scripts/random_revision_topic.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +find / -type f > list_of_files.list \ No newline at end of file