- Timestamp:
- Oct 11, 2022, 7:34:08 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kanako
r4 r6 1 1 #!/bin/sh -e 2 2 3 conf_dir= ${conf_dir:-$HOME/.config/kanako}4 key_dir= ${key_dir:-$HOME/.kanako}5 store_dir= ${store_dir:-$HOME/.kanako-store}3 conf_dir="${conf_dir:-$HOME/.config/kanako}" 4 key_dir="${key_dir:-$HOME/.kanako}" 5 store_dir="${store_dir:-$HOME/.kanako-store}" 6 6 7 if test -d ${store_dir}; then8 cd ${store_dir}7 if test -d "${store_dir}"; then 8 cd "${store_dir}" 9 9 else 10 10 echo "Password store not found!" … … 13 13 fi 14 14 15 if test -f ${conf_dir}/kanako.conf; then16 . ${conf_dir}/kanako.conf;15 if test -f "${conf_dir}/kanako.conf"; then 16 . "${conf_dir}/kanako.conf"; 17 17 else 18 18 echo "Configuration file has not been found!" … … 23 23 24 24 fn_copy() { 25 fn_view $1 | ${clip_cmd}25 fn_view $1 | "${clip_cmd}" 26 26 } 27 27 fn_edit() { 28 ${decrypt_cmd} ${decrypt_args} ${1%%.enc}.enc > ${1%%.enc}29 ${EDITOR} ${1%%.enc}30 ${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc31 rm ${1%%.enc}28 "${decrypt_cmd}" "${decrypt_args}" "${1%%.enc}.enc" > "${1%%.enc}" 29 "${EDITOR}" "${1%%.enc}" 30 "${encrypt_cmd}" "${encrypt_args}" "${1%%.enc}" > "${1%%.enc}".enc 31 rm "${1%%.enc}" 32 32 } 33 33 fn_generate() { 34 pwgen -s ${1:-80}34 pwgen -s "${1:-80}" 35 35 } 36 36 fn_list() { 37 ${list_cmd} ${store_dir}37 "${list_cmd}" "${store_dir}" 38 38 } 39 39 fn_new() { 40 40 test -d $1 && fn_usage && exit 1 41 41 42 tmpfile= $(mktemp)43 ${EDITOR} ${tmpfile}42 tmpfile="$(mktemp)" 43 "${EDITOR}" "${tmpfile}" 44 44 45 mkdir -p $(dirname $1)46 ${encrypt_cmd} ${encrypt_args} ${tmpfile} > ${1%%.enc}.enc45 mkdir -p "$(dirname "$1")" 46 "${encrypt_cmd}" "${encrypt_args}" "${tmpfile}" > "${1%%.enc}".enc 47 47 rm ${tmpfile} 48 48 } … … 51 51 } 52 52 fn_trash_entry() { 53 rm -f ${1}${2},enc53 rm -f "${1}${2}".enc 54 54 } 55 55 fn_usage() { … … 61 61 } 62 62 fn_view() { 63 if [ -f ${1%%.enc}.enc ]; then64 ${encrypt_cmd} ${decrypt_args} ${1%%.enc}.enc65 elif [ -d ${1:-.}]; then66 ${list_cmd} ${1:-.}63 if [ -f "${1%%.enc}".enc ]; then 64 ${encrypt_cmd} ${decrypt_args} "${1%%.enc}".enc 65 elif [ -d "${1:-.}" ]; then 66 ${list_cmd} "${1:-.}" 67 67 else 68 68 fn_usage
Note:
See TracChangeset
for help on using the changeset viewer.