mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-06-24 22:11:20 +02:00
Minor refactor
- Use read to split on space between name and flags instead of paramater expansion.
This commit is contained in:
parent
57be774f88
commit
990a1dc397
@ -78,17 +78,17 @@ determine_stat_variant() {
|
|||||||
local varient name cmd ts
|
local varient name cmd ts
|
||||||
|
|
||||||
for varient in "gnu -c %Z" "bsd -f %m"; do
|
for varient in "gnu -c %Z" "bsd -f %m"; do
|
||||||
name="${varient%% *}" cmd="stat ${varient#* }"
|
read -r name flags <<< "$varient"
|
||||||
|
|
||||||
# keep the results of the stash command
|
# save the results of the stat command
|
||||||
if read -r ts < \
|
if read -r ts < \
|
||||||
<( ${cmd} "$0" 2>/dev/null ); then
|
<( stat ${flags} "$0" 2>/dev/null ); then
|
||||||
|
|
||||||
# verify that the value is an epoch timetamp
|
# verify that the value is an epoch timetamp
|
||||||
# before proceeding
|
# before proceeding
|
||||||
if [[ "${ts}" =~ ^[0-9]+$ ]]; then
|
if [[ "${ts}" =~ ^[0-9]+$ ]]; then
|
||||||
|
|
||||||
POLL_STAT_COMMAND=( ${cmd} )
|
POLL_STAT_COMMAND=( stat ${flags} )
|
||||||
POLL_STAT_VARIANT="$name"
|
POLL_STAT_VARIANT="$name"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user