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