-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRemaining Disk Space (GB).xml
38 lines (38 loc) · 1.46 KB
/
Remaining Disk Space (GB).xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute>
<displayName>Remaining Disk Space (GB)</displayName>
<description/>
<dataType>number</dataType>
<scriptContentsMac>#!/bin/bash
####################################################################
#.DESCRIPTION
# Detect Remaining Disk space (GB) on /System/Volumes/Data using
# df binary and return integer only
#
#.NOTES
# The script when executed displays information about the disk
# space usage on the file system where "/System/Volumes/Data" is
# located in human readable format. This is then piped to awk to
# process the output, tail to retrieve the last line, then return
# it to getFreeDiskSpace variable.
#
# freeDiskSpace=${getFreeDiskSpace%G}: This line removes the
# trailing "G" (indicating gigabytes) from the value stored in
# getFreeDiskSpace. The %G is a shell parameter expansion that
# removes the specified suffix from the variable's value.
#
#
#
#.FILEINFO
# Author: Lloyd
# Creation Date: 01/24/2024
# Purpose/Change: Initial script development
#
###################################################################
getFreeDiskSpace=$(df -H /System/Volumes/Data/ | awk '{print $4}' | tail -n 1)
freeDiskSpace=${getFreeDiskSpace%G}
echo "<result>"$freeDiskSpace"</result>"</scriptContentsMac>
</extensionAttribute>