logoISU  

CS469/569 - Linux and Unix Administration and Networking

Spring 2022

Displaying ./code/02-01-Bash2/redir.sh

#!/bin/bash

echo "Read input from a file" < /dev/zero

echo "Output to a file" > /dev/null

echo "Appended output to a file" >> /dev/null

echo "Stderr:"

echo "Output stderr to a file" 2> /dev/null
echo "Appended stderr to a file" 2>> /dev/null

echo "stdout & stderr:"

echo "Output both stdout & stderr to a file" &> /dev/null
echo "Append both stdout & stderr to a file" &>> /dev/null

echo "Heredoc:"

var=foobarbaz

cat <<LABEL
	Hello, $var:
	..
	$var
LABEL