Skip to content

Instantly share code, notes, and snippets.

@Vulcalien
Created April 14, 2022 09:29
Show Gist options
  • Select an option

  • Save Vulcalien/2ca66ec4e5f33c42c9a53da9a0263b81 to your computer and use it in GitHub Desktop.

Select an option

Save Vulcalien/2ca66ec4e5f33c42c9a53da9a0263b81 to your computer and use it in GitHub Desktop.

Revisions

  1. Vulcalien created this gist Apr 14, 2022.
    6 changes: 6 additions & 0 deletions battery
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #!/bin/sh

    charge_now=$(cat /sys/class/power_supply/BAT0/charge_now)
    charge_full=$(cat /sys/class/power_supply/BAT0/charge_full)

    echo $((100 * $charge_now / $charge_full))%