Skip to content

Instantly share code, notes, and snippets.

@ypetya
Created July 27, 2016 12:08
Show Gist options
  • Select an option

  • Save ypetya/7a3485a9e958428f950f0cbfad9a30c3 to your computer and use it in GitHub Desktop.

Select an option

Save ypetya/7a3485a9e958428f950f0cbfad9a30c3 to your computer and use it in GitHub Desktop.
Take a "secret" note!
#!/bin/bash
rm -f "$0.1"
while read line ; do
if [ ! -z $enc ] ; then
echo "$line" | xxd -ps -r
fi
[ -z $enc ] && [ "${line:0:2}" = '#-' ] && enc=1
if (( ${#line} > 0 )) ; then
echo $line >> "$0.1"
fi
done < $0
read -r line
if (( ${#line} > 0 )) ; then
echo $line | xxd -ps >> "$0.1"
fi
(
sleep 1
mv "$0.1" $0
)
exit 0
#-
54616b65206120736563726574206e6f7465210a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment