Change 31814

tom_tyler (C. Thomas Tyler)
C. Thomas Tyler committed this change into //guest/perforce_software/sdp/dev under Review 31815
View Review
Download .zip
Improved convert_to_bytes():
* Supports T (terabytes), P (petabytes), E (exabytes).
* Case-insensitive units (k or K, m or M, etc.)
* Returns raw integer bytes without B suffix.
* Falls back to raw bytes if no unit provided.
* Handles negative numbers gracefully.

Added convert_to_human_readable():

Both functions use 'echo' to display output and return 0 if
a conversion was possible. If a conversion was not possible,
display no output and give an exit code of 1.

Added SizeConversion test group to /p4/sdp/test/bsw/cli_tests.cfg
to test these function in the backup_function.sh library.

#review-31815
  • Files 2
  • Comments 0
2 edited 0 added 0 deleted
Server/Unix/p4/common/bin/backup_functions.sh#167
Loading...
test/bsw/cli_tests.cfg#22
Loading...
Tip: Use n and p to cycle through the changes.