As I've been learning more about Ubuntu and bash programming I've been storing variables in /tmp. For example in-between calls to the same bash script I want to record the previous state.
On my current single user system there is no danger of conflicts in /tmp directory. However I want my code to be future-proof and wonder if I should get in the habit of using a directory called ~/tmp?
Perhaps it should be ~/.tmp and hidden. Perhaps it should be ~/temp so as not to be confused with conventional /tmp directory.
Any ideas / suggestions are appreciated. Thank you.
/tmpbut name the files with some randomness attached to the filename.head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo ''I'm sure this has it's own set of caveats. – Feb 12 '17 at 17:00/tmp/lock-screen-timer-remainingwhich contains a single line with "30 minutes", "29 minutes" ... – WinEunuuchs2Unix Feb 12 '17 at 17:08$$variable inbashscript as part of the file, as your process ID should be unique in a running system. Or create a user directory in/tmp. The advantage of/tmpdirectory is that it is emptied at reboot when properly configured. – ridgy Feb 12 '17 at 17:58/tmpdo you know if it's common practice? – WinEunuuchs2Unix Feb 12 '17 at 18:11ls -l /tmp), to see what applications do (all directories owned by you are created for you, and some will have your username in the directory name...) – ridgy Feb 12 '17 at 18:20