#!/bin/fish set selection (fzf) set selection (echo $selection | sed 's,/[^/]*$,,') if [ ! $selection = "\S" ] cd $selection end