Use variable quoting
Signed-off-by: Aoi K <koizumi.aoi@kyoko-project.wer.ee> git-svn-id: file:///srv/svn/repo/kanako/trunk@6 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e
This commit is contained in:
parent
13f6bdfeb4
commit
334729396a
46
kanako
46
kanako
@ -1,19 +1,19 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
conf_dir=${conf_dir:-$HOME/.config/kanako}
|
||||
key_dir=${key_dir:-$HOME/.kanako}
|
||||
store_dir=${store_dir:-$HOME/.kanako-store}
|
||||
conf_dir="${conf_dir:-$HOME/.config/kanako}"
|
||||
key_dir="${key_dir:-$HOME/.kanako}"
|
||||
store_dir="${store_dir:-$HOME/.kanako-store}"
|
||||
|
||||
if test -d ${store_dir}; then
|
||||
cd ${store_dir}
|
||||
if test -d "${store_dir}"; then
|
||||
cd "${store_dir}"
|
||||
else
|
||||
echo "Password store not found!"
|
||||
echo "Please run kanako-init"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -f ${conf_dir}/kanako.conf; then
|
||||
. ${conf_dir}/kanako.conf;
|
||||
if test -f "${conf_dir}/kanako.conf"; then
|
||||
. "${conf_dir}/kanako.conf";
|
||||
else
|
||||
echo "Configuration file has not been found!"
|
||||
echo "Copy kanako.conf.example from the repository,"
|
||||
@ -22,35 +22,35 @@ else
|
||||
fi
|
||||
|
||||
fn_copy() {
|
||||
fn_view $1 | ${clip_cmd}
|
||||
fn_view $1 | "${clip_cmd}"
|
||||
}
|
||||
fn_edit() {
|
||||
${decrypt_cmd} ${decrypt_args} ${1%%.enc}.enc > ${1%%.enc}
|
||||
${EDITOR} ${1%%.enc}
|
||||
${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc
|
||||
rm ${1%%.enc}
|
||||
"${decrypt_cmd}" "${decrypt_args}" "${1%%.enc}.enc" > "${1%%.enc}"
|
||||
"${EDITOR}" "${1%%.enc}"
|
||||
"${encrypt_cmd}" "${encrypt_args}" "${1%%.enc}" > "${1%%.enc}".enc
|
||||
rm "${1%%.enc}"
|
||||
}
|
||||
fn_generate() {
|
||||
pwgen -s ${1:-80}
|
||||
pwgen -s "${1:-80}"
|
||||
}
|
||||
fn_list() {
|
||||
${list_cmd} ${store_dir}
|
||||
"${list_cmd}" "${store_dir}"
|
||||
}
|
||||
fn_new() {
|
||||
test -d $1 && fn_usage && exit 1
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
${EDITOR} ${tmpfile}
|
||||
tmpfile="$(mktemp)"
|
||||
"${EDITOR}" "${tmpfile}"
|
||||
|
||||
mkdir -p $(dirname $1)
|
||||
${encrypt_cmd} ${encrypt_args} ${tmpfile} > ${1%%.enc}.enc
|
||||
mkdir -p "$(dirname "$1")"
|
||||
"${encrypt_cmd}" "${encrypt_args}" "${tmpfile}" > "${1%%.enc}".enc
|
||||
rm ${tmpfile}
|
||||
}
|
||||
fn_trash_directory() {
|
||||
rm -rf $@
|
||||
}
|
||||
fn_trash_entry() {
|
||||
rm -f ${1}${2},enc
|
||||
rm -f "${1}${2}".enc
|
||||
}
|
||||
fn_usage() {
|
||||
cat <<EOF
|
||||
@ -60,10 +60,10 @@ kanako [copy|edit|gen|list|add|trash|trashd|view] <arguments>
|
||||
EOF
|
||||
}
|
||||
fn_view() {
|
||||
if [ -f ${1%%.enc}.enc ]; then
|
||||
${encrypt_cmd} ${decrypt_args} ${1%%.enc}.enc
|
||||
elif [ -d ${1:-.} ]; then
|
||||
${list_cmd} ${1:-.}
|
||||
if [ -f "${1%%.enc}".enc ]; then
|
||||
${encrypt_cmd} ${decrypt_args} "${1%%.enc}".enc
|
||||
elif [ -d "${1:-.}" ]; then
|
||||
${list_cmd} "${1:-.}"
|
||||
else
|
||||
fn_usage
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user