[pass] [feature] dir command, for changing $PASSWORD_STORE_DIR

George Angelopoulos george at usermod.net
Sun Oct 19 15:32:26 CEST 2014


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
>> Password-Store at lists.zx2c4.com
>> http://lists.zx2c4.com/mailman/listinfo/password-store
> _______________________________________________
> Password-Store mailing list
> Password-Store at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/password-store



More information about the Password-Store mailing list