Skip to content

Instantly share code, notes, and snippets.

@Gen2ly
Created August 26, 2013 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gen2ly/6344046 to your computer and use it in GitHub Desktop.
Save Gen2ly/6344046 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Create temporary file(s) and open in gedit
# Program required: gedit test
hash gedit 2>&- || { echo " Program required \"gedit\" not installed"; exit 1; }
# Display usage
if [[ $1 == -h ]]; then
echo "gt [name*] [name*]... - create temporary file(s) and open in gedit"
exit 1; fi
tmp_dir="/home/$USER/.local/share/Trash/files"
time="$(date +%m%d%H%M)"
# Trash directory create if doesn't exist
[ ! -d "$tmp_dir" ] && mkdir -p "$tmp_dir"
# Open temporary file(s) in gedit
if [[ -n $1 ]]; then
for name in "$@"; do
nohup gedit "$tmp_dir"/"$time""$name" &> /dev/null &
done
else
nohup gedit "$tmp_dir"/"$time" &> /dev/null &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment