Rather than re-write your scripts to store temp files into /dev/shm, you can just mount /tmp using the tmpfs file system and get the same benefit for all your programs. Some distros do this by default.
The relevant line from fstab is:
tmpfs /tmp tmpfs noatime 0 2
Now any program that writes to /tmp will be writing to a RAM disk, thus sparing unnecessary wear on my SSD. replies(7):