rupa / z

z - jump around
Do What The F*ck You Want To Public License
16.32k stars 1.17k forks source link

call z.sh in own script #281

Closed arsiarola closed 2 years ago

arsiarola commented 4 years ago

The z is working well for me but I thought about using it in my own script and it feels like I cannot get it to work.

If I use 'source path/to/rupa/z.sh' in the script I get 141: Syntax: error: redirection unexpected

aduros commented 3 years ago

I got it to work by putting this in a script called z-external:

#!/bin/bash

# Set vars if necessary
#_Z_DATA="$HOME/.cache/z_data"

. ~/.config/z.sh
_z "$@"

Then you can run eg: z-external -e foo from anywhere.

arsiarola commented 3 years ago

Oh yeah I got it to work after I checked from fzf with rupa z integrations how theyve done it and not sure but maybe the problem was that I had already sourced it from .bashrc or something, but now that I put the script in .bashrc its good.

FranklinYu commented 2 years ago

Took me a while to find the “fzf-z integration”: https://github.com/junegunn/fzf/wiki/examples#z

arsiarola commented 2 years ago

Took me a while to find the “fzf-z integration”: https://github.com/junegunn/fzf/wiki/examples#z

Yeah that was it, sry my bad forgot to leave the link here for others.