From 3c1d81d1fe1b68b2ed282e746f7573d953ad5da5 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 2 Apr 2022 14:00:47 +0300 Subject: .local/bin: bash best practices Additionally, virsh -q gets rid of that stupid empty line virsh for some reason prints out every time. --- %HOME%/.local/bin/vagrant-update-all-boxes.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to '%HOME%/.local/bin/vagrant-update-all-boxes.sh') diff --git a/%HOME%/.local/bin/vagrant-update-all-boxes.sh b/%HOME%/.local/bin/vagrant-update-all-boxes.sh index 6d7e5a8..6f4b61c 100755 --- a/%HOME%/.local/bin/vagrant-update-all-boxes.sh +++ b/%HOME%/.local/bin/vagrant-update-all-boxes.sh @@ -8,7 +8,7 @@ # This script updates all Vagrant boxes. set -o errexit -o nounset -o pipefail -shopt -s inherit_errexit +shopt -s inherit_errexit lastpipe dump() { local msg @@ -45,13 +45,10 @@ update_box_from_line() { } update_all_boxes() { - local output - output="$( vagrant box outdated --global | grep -F outdated )" - local line - while IFS= read -r line; do + vagrant box outdated --global | grep -F outdated | while IFS= read -r line; do update_box_from_line "$line" - done <<< "$output" + done } clean_old_boxes() { -- cgit v1.2.3