aboutsummaryrefslogtreecommitdiff
path: root/libexec/rc/rc.d/growfs
diff options
context:
space:
mode:
authorKurt Lidl <lidl@FreeBSD.org>2019-03-11 13:33:03 +0000
committerKurt Lidl <lidl@FreeBSD.org>2019-03-11 13:33:03 +0000
commitc65b552f895bcb8ea931da6304108a3e008ff669 (patch)
treed28c1adcd07268b3fbac36462adad1dee279759d /libexec/rc/rc.d/growfs
parentca0f03e808edc4f54bfcb16b46532604ecad83a8 (diff)
downloadsrc-c65b552f895bcb8ea931da6304108a3e008ff669.tar.gz
src-c65b552f895bcb8ea931da6304108a3e008ff669.zip
Remove an unneeded 'tail -n 1' from a pipeline
When piping to awk, it's almost always an anti-pattern to use 'grep' first. When not in a pipeline, sometimes it is faster to use tail, as awk must process all the lines in the input stream, and won't 'seek'. In a pipeline, both grep and awk must process all lines, so we might as well skip the extra process creation for tail and just use awk for all the processing. Reviewed by: jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19441
Notes
Notes: svn path=/head/; revision=345005
Diffstat (limited to 'libexec/rc/rc.d/growfs')
-rwxr-xr-xlibexec/rc/rc.d/growfs2
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/rc/rc.d/growfs b/libexec/rc/rc.d/growfs
index 98f1d9b649c1..039813c8f3ee 100755
--- a/libexec/rc/rc.d/growfs
+++ b/libexec/rc/rc.d/growfs
@@ -57,7 +57,7 @@ growfs_start ()
;;
zfs)
pool=${FSDEV%%/*}
- rootdev=$(zpool list -v $pool | tail -n 1 | awk '{ print $1 }')
+ rootdev=$(zpool list -v $pool | awk 'END { print $1 }')
;;
*)
echo "Don't know how to grow root filesystem type: $FSTYPE"