Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
################################################################################ # Function: create_temp_file # Description: Creates a temporary file # Arguments: $1 :- temporary directory name (required) # Outputs: Prints name of the created temporary directory function create_temp_file { local temp_dir="${1:?'create_temp_file requires a 1st argument: temp dir'}" local prefix prefix=$(basename "${temp_dir}") local temp_file="${temp_dir}/${prefix}.${RANDOM}${RANDOM}${RANDOM}" if ! touch "${temp_file}" || ! chmod 600 "${temp_file}"; then echo "FATAL: Unable to create temp file: ${temp_file}: $?" >&2 exit 1 fi echo "${temp_file}" }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)