In a shell script, I'm looking for a way to pass the du (disk usage) result to a numeric variable, so that I cantie the execution of a shell script to the size of a specific folder. I've tried something like size=$(du -sh /folder) but this passes an alphanumeric value to the variable 'size', plus the name of the folder, which is obviously not what I want.
I'm using OSX, but I believe this is more of a bash/linux question. Has anybody an idea on how to achieve that? Thank you very much.