/
timaliev
/
bin-scripts
Обзор
Документация
Войти
/
timaliev
/
bin-scripts
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
encrypt
25 строк
605 B
Tim Aliev
Simple script around age(1)
07 фев 2024, 00:06
07 фев 2024, 00:06
1daa215
Код
Авторство
О чём код?
#!/usr/bin/env bash set -Eeuo pipefail L=$(stat -f $0) scriptname=$(basename $L) function die() { echo -e $1 exit 127 } if [ $# -ne 1 ]; then echo -e "Usage: ${scriptname} <file>" echo echo -e "Please specify exectly one file to be encrypted" echo -e "Encrypted file will be in the current directory with .age extension" exit 127 fi [ -f $1 ] && [ ! -f ${1}.age ] && \ curl -s https://github.com/timaliev.keys | \ age -e -R - -o ${1}.age $1 || \ die "Error. No such file (${1}) or file ${1}.age exists." ERR=$? [ -f ${1}.age ] && echo "Created encrypted file: ${1}.age " exit $?