LDP/LDP/guide/docbook/abs-guide/lastpipe-option.sh

21 lines
524 B
Bash

#!/bin/bash
# lastpipe-option.sh
line='' # Null value.
echo "\$line = "$line"" # $line =
echo
shopt -s lastpipe # Error on Bash version -lt 4.2.
echo "Exit status of attempting to set \"lastpipe\" option is $?"
# 1 if Bash version -lt 4.2, 0 otherwise.
echo
head -1 $0 | read line # Pipe the first line of the script to read.
# ^^^^^^^^^ Not in a subshell!!!
echo "\$line = "$line""
# Older Bash releases $line =
# Bash version 4.2 $line = #!/bin/bash