aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-01-08 13:46:13 -0500
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-01-08 13:46:13 -0500
commit599ca0c2c1d3562b7090884ad237b83cf792a5ff (patch)
tree04a10068d05e37056966c444269aec7201eddc53
parent20432e8cb24528b006c174cf598559f268ffe035 (diff)
downloadkvm-manager-599ca0c2c1d3562b7090884ad237b83cf792a5ff.tar.gz
kvm-manager-599ca0c2c1d3562b7090884ad237b83cf792a5ff.tar.bz2
avoid use of temp files in kvm-status
-rwxr-xr-xkvm-status23
1 files changed, 11 insertions, 12 deletions
diff --git a/kvm-status b/kvm-status
index 08445cc..9a2c6fc 100755
--- a/kvm-status
+++ b/kvm-status
@@ -14,15 +14,14 @@ function convert_ram {
fi
}
-temp=$(mktemp)
-echo "SERVER RAM" > "$temp"
-total_ram=0
-for foo in $(ls $dir); do
- ram=$(cat $dir/$foo/env/RAM)
- convert_ram "$ram"
- echo "$foo $display_ram" >> "$temp"
- total_ram=$(( $total_ram + $display_ram ))
-done
-echo "TOTAL $total_ram" >> "$temp"
-column -t "$temp"
-rm "$temp"
+{
+ echo "SERVER RAM"
+ total_ram=0
+ for foo in $(ls $dir); do
+ ram=$(cat $dir/$foo/env/RAM)
+ convert_ram "$ram"
+ echo "$foo $display_ram"
+ total_ram=$(( $total_ram + $display_ram ))
+ done
+ echo "TOTAL $total_ram"
+} | column -t