First versions of the binaries and source file.
This commit is contained in:
parent
d2630d6e4f
commit
1dfda10ddc
11 changed files with 742 additions and 0 deletions
27
editx
Executable file
27
editx
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
# !/bin/bash
|
||||
# This utility pre-allocs a file and adds execution permissions. It also
|
||||
# removes the resulting file if it is empty after the editor closes.
|
||||
|
||||
if [[ -z $1 ]];
|
||||
then
|
||||
echo "No filename specified."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ -z "${EDITOR}" ]];
|
||||
then
|
||||
ched "EDITOR env variable not set! You will have to set it yourself in the next screen."
|
||||
fi
|
||||
|
||||
exists=$(file "$1" >/dev/null && echo $?)
|
||||
|
||||
touch "$1"
|
||||
chmod +x "$1"
|
||||
$EDITOR "$1"
|
||||
wait $!
|
||||
SIZE=$(du "$1" | cut -f 1)
|
||||
|
||||
if [[ $SIZE -eq 0 && $exists -ne 0 ]];
|
||||
then
|
||||
rm -rf "$1"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue