#!/bin/bash
# ======================================
#   Developed by Adrian DC - 2015-2016
# ======================================

free;
sudo echo '';

commands=$(echo \
'sudo sync
swapoff -a
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
swapon -a' \
| sed 's/^ *//g');

OLDIFS="${IFS}";
IFS=$'\n';
for command in ${commands}; do
  echo " [${command}]";
  sudo sh -c "timeout 5 ${command}";
done;
IFS="${OLDIFS}";

echo "";
free;

#!/bin/bash
# ======================================
#   Developed by Adrian DC - 2015-2016
# ======================================

free;
sudo echo '';

commands=$(echo \
'sync
swapoff -a
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
swapon -a' \
| sed 's/^ *//g');

OLDIFS="${IFS}";
IFS=$'\n';
for command in ${commands}; do
  echo " [${command}]";
  sudo sh -c "timeout 5 ${command}";
done;
IFS="${OLDIFS}";

echo "";
free;

Remove unnecessary sudo second usage
cleanram: Remove unnecessary sudo second usage

Change-Id: I3544bf62133fe6fa0992208991fd59bac29781d8
Signed-off-by: Adrian DC <01fb3892f39957945220431e7409156544d2f041@gmail.com>
