Tag Info

New answers tagged


A loop device is a particular type of block device, managed by the loop device driver. A loop device is a block device whose content is stored in a file, similar to the way a SCSI disk device is a block device whose content is stored on a SCSI disk, a USB storage device is a block device whose content is stored on a USB storage peripheral, etc. Linux has a ...


continue jumps to the next iteration of the loop. break exits the loop altogether. Neither is useful if you want to have some effect on future iterations. For that, you need to remember the information that something has to behave differently. The way to remember some information is to store it in a variable. One way to do what you want is to store the ...


push(){ shuttle push note Chrome \ "Aurora: $1" \ "Battery is at $percent percent" } full=0 while percent=$(acpi | awk '{ print $4}' | sed 's/[,%]//g') do case $percent:$full in (100:1) ;; (100:0) full=1 push 'Battery charged';; (?:*|1?:*|20:*) full=0 ...


How about: if [ "$percent" -eq 100 ] && [ "$full_flag" -eq 0 ]; then shuttle push note Chrome "Aurora: Battery charged" "Battery is at $percent percent" full_flag=1 fi if [ "$percent" -lt 100 ]; then full_flag=0 fi


RTFM: while The syntax of the while command is: while test-commands; do consequent-commands; done Execute consequent-commands as long as test-commands has an exit status of zero. The return status is the exit status of the last command executed in consequent-commands, or zero if none was executed. If you want to acquire a return value from ...


Your while loop evaluates on a boolean value. In this case you could also read it as while true or while 0. So if emacs returns another value like 1 if it is killed the loop ends.

Top 50 recent answers are included