#! /bin/bash if [[ $(uname) != "Linux" ]]; then echo "Not on Linux : no tmpfs" exit fi CWD=$(cd -P . && pwd) readarray -t TMPFS_DIRS < <(df -lt tmpfs --output=target | tail -n +2) if [[ " ${TMPFS_DIRS[*]} " =~ " ${CWD}/public " ]]; then echo "public alread a tmpfs" else echo "Mounting public as tmpfs" sudo mount -m -t tmpfs tmpfs public fi