Skip to content

Commit 899d1ec

Browse files
author
Konrad Lother
committed
yet another path fix
1 parent 6892bc3 commit 899d1ec

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

file.bash

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
print_usage() {
44
echo "Usage: $PROGRAM file action pass-name [path]"
@@ -9,10 +9,14 @@ print_usage() {
99
}
1010

1111
cmd_store() {
12-
local path="$1.b64"
12+
local path="$1"
1313
local file="$2"
1414
local passfile="$PREFIX/$path.gpg"
1515

16+
if [[ ${path: -4} != ".b64" ]]; then
17+
path="${path}.b64"
18+
fi
19+
1620
cd $OLDPWD # fix for relative paths
1721

1822
check_sneaky_paths "$1"
@@ -41,9 +45,13 @@ cmd_store() {
4145
}
4246

4347
cmd_retrieve() {
44-
local path="$1.b64"
48+
local path="$1"
4549
local passfile="$PREFIX/$path.gpg"
4650

51+
if [[ ${path: -4} != ".b64" ]]; then
52+
path="${path}.b64"
53+
fi
54+
4755
if [[ -z $path ]]; then
4856
print_usage
4957
else

0 commit comments

Comments
 (0)