LDP/LDP/guide/docbook/abs-guide/redir5.sh

23 lines
364 B
Bash

#!/bin/bash
if [ -z "$1" ]
then
Filename=names.data # Default, if no filename specified.
else
Filename=$1
fi
TRUE=1
if [ "$TRUE" ] # if true and if : also work.
then
read name
echo $name
fi <"$Filename"
# ^^^^^^^^^^^^
# Reads only first line of file.
# An "if/then" test has no way of iterating unless embedded in a loop.
exit 0