And without readlink. This also works on OSX and netbsd which don't have readlink
(they do but it does a completely different thing).

# change the password store directory
function passdir {
    if [[ -n "$1" ]]; then
        export PASSWORD_STORE_DIR="$(cd "$1"; pwd)"
    else
        unset PASSWORD_STORE_DIR
    fi
}


On 10/17/2014 10:59 PM, George Angelopoulos wrote:
improved a bit with 'readlink'

# change the password store directory
function passdir {
     if [[ -n "$1" ]]; then
         export PASSWORD_STORE_DIR="$(readlink -nf "$1")"
     else
         unset PASSWORD_STORE_DIR
     fi
}

On 10/17/2014 06:31 PM, George Angelopoulos wrote:
I've just started using pass with more than one password stores. Running
"export PASSWORD_STORE_DIR='./password-store-2'" all the time is of
course inconvenient.
I've made a "passdir" shell function that does this with less typing:

# change the password store directory
function passdir {
     if [[ -n "$1" ]]; then
         wdsave=`pwd`
         cd `dirname "$0"`
         export PASSWORD_STORE_DIR="`pwd`/$1"
         cd $wdsave
     else
         unset PASSWORD_STORE_DIR
     fi
}


This could also be implemented in pass itself, as a command, like "pass
dir $dirname". Is there any interest for this? Is it feature creep? I'm
ok sticking with my shell function but I thought I'd mention it.

_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store
_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store

_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to