From 8f9e3adec1e0a0fa59568aae1412108844b9694a Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Wed, 5 Feb 2020 12:49:52 +0100 Subject: [PATCH] Switch from `stat` to `du` and `cut` to make this tool (more) POSIX compatible. Fixes #3. --- matrix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix.sh b/matrix.sh index 8f8249e..7754fc0 100755 --- a/matrix.sh +++ b/matrix.sh @@ -235,7 +235,7 @@ send_file() { # Query max filesize from server get "/_matrix/media/r0/config" max_size=`jq -r ".[\"m.upload.size\"]" <<<"$response"` - size=$(stat -c%s "$FILE") + size=$(du -b "$FILE" | cut -f1) if (( size > max_size )); then die "File is too big. Size is $size, max_size is $max_size." fi