【发布时间】:2016-09-29 09:36:31
【问题描述】:
使用此命令 (upower -i /org/freedesktop/UPower/devices/battery_BAT1) 我的终端显示以下输出:
native-path: BAT1
vendor: LG
power supply: yes
updated: mar 31 may 2016 12:45:15 CEST (101 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: fully-charged
warning-level: none
energy: 50,4088 Wh
energy-empty: 0 Wh
energy-full: 51,4522 Wh
energy-full-design: 48,1 Wh
energy-rate: 6,29 W
voltage: 8,313 V
percentage: 97%
capacity: 100%
icon-name: 'battery-full-charged-symbolic'
我需要获取一个包含输出数据的数组。像这样的东西:[BAT1, LG, yes, [...], 100%, 'battery-full-charged-symbolic']
有什么办法吗?
【问题讨论】:
-
你的意思是 Bash 数组吗?
标签: shell ubuntu sed grep battery