Every now and then I need to do simple arithmetic in a command-line environment. E.G. given the following output:
Disk /dev/sdb: 256GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 106MB 105MB fat32 hidden, diag 2 106MB 64.1GB 64.0GB ext4 3 64.1GB 192GB 128GB ext4 5 236GB 256GB 20.0GB linux-swap(v1)
What's a simple way to calculate on the command line the size of the unallocated space between partition 3 and 5?
What I've tried already:
bc bc 1.06.95 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 236-192 44 quit
where the bold above is all the stuff I need to type to do a simple
bc 1+1 echoes
File 1+1 is unavailable.
expr 236 - 192
where I need to type spaces before and after the operator as
expr 1+1 just echoes