Timeline for How can I safely create and access temp files from shell scripts?
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 25, 2017 at 19:26 | comment | added | Gilles 'SO- stop being evil' | @jww Bash's random results are weak: it's an LCG, which is about as predictable as it gets while being good enough for many applications that don't require unpredictability. | |
| Oct 25, 2017 at 19:25 | history | edited | Gilles 'SO- stop being evil' | CC BY-SA 3.0 |
RANDOM is not suitable not just because of the number of values, but also because it's a very basic RNG
|
| Oct 25, 2017 at 9:24 | comment | added | user56041 |
mktemp is not available on AIX or the Git shell on Windows. It looks like file.$RANDOM$RANDOM is the portable solution. The $RANDOM$RANDOM should increase space to 2^32, assuming Bash random results are independent and not weak.
|
|
| Dec 16, 2015 at 19:42 | vote | accept | Wildcard | ||
| Oct 24, 2015 at 13:51 | comment | added | Wildcard |
Actually your discussion of $TMPDIR and ~/.cache is exactly what I needed. After some further thought I realized that the only reason I wanted it in /tmp was partitioning—so the cache couldn't fill up the /home partition. But for this use case that is really a complete non-issue, so a subdirectory of ~/.cache fits my needs perfectly and avoids the security issue.
|
|
| Oct 24, 2015 at 13:47 | vote | accept | Wildcard | ||
| Dec 16, 2015 at 19:42 | |||||
| Oct 15, 2015 at 0:49 | history | answered | Gilles 'SO- stop being evil' | CC BY-SA 3.0 |