unbox/utils.sh
2020-01-31 15:29:45 +01:00

26 lines
418 B
Bash
Executable file

#!/bin/bash
function prefix_time(){
while read LINE; do
echo "["$(date)"] "$LINE
done
}
function export_env(){
if [ $# -lt 2 ]; then
echo not enogh arguments for export_env
exit 1
fi
VAR=${1}
shift
echo ${VAR}=${@} >> ${UNBOX_ENV_FILE}
export ${VAR}=${@}
}
function mem_size(){
echo $(($(cat /proc/meminfo | grep MemTotal | awk '{print $2}')*1024))
}
function dev_size(){
blockdev --getsize64 $1
}