#!/bin/sh if [ "$(id -u)" -ne 0 ]; then echo "This script should be run as root. Aborting..." > /dev/stderr exit 1 fi echo "Disabling swap..." swapoff -a echo "Disabling swap permanently ('/etc/fstab.bak' created)..." sed -i.bak '/ swap /d' /etc/fstab