[[ -f /proc/mounts ]] || { echo "mkofs: only supported on linux" >&2 return 1 } local o if [[ -d "$PWD/o" ]]; then o=$PWD/o elif [[ -n "$COSMO" && -d "$COSMO/o" ]]; then o=$COSMO/o else echo "mkofs: o/ not found" >&2 return 1 fi o=$(realpath "$o") cut -d' ' -f2 /proc/mounts | while read -r line; do if [[ "$o" = "$line" ]]; then echo "mkofs: $o already mounted" >&2 return 0 fi done ( set -x sudo mount -t tmpfs -o size=10G,noatime,nodiratime /dev/shm "$o" ) # vim:ft=zsh