I am trying to use du -sk
to get the size of two folders
dirsize_temp=`du -sk /folder/path/here`
and then an if statement to compare the sizes. The only issue is that when you run the command, it returns something like
123456 /folder/path/here
I am currently using
dirsize=${dirsize_temp%%/*}
to strip the "/folder/path/here
" part, but I am having problems getting rid of the spaces. They do not seem to be actual spaces, so "${dirsize//\ /}
" or "${dirsize// /}
" does not work to remove them, but they still keep me from comparing two variables. Is there some escape character I am missing, or an easier way to get the size of two folders without extra stuff tacked on the end?
-h
and-k
are mutually exclusive. Pick one.