Skip to content

Instantly share code, notes, and snippets.

@kotet
Last active Oct 20, 2020
Embed
What would you like to do?
ディレクトリをたどってファイルのパスを得るツール
#!/bin/bash
file-select() {
(
cd "${1}"
path=$(ls -a | peco)
path=$(readlink -f "${path}")
if [[ -d "${path}" ]]; then
file-select "${path}"
elif [[ -f "${path}" ]]; then
echo "${path}"
else
exit 1
fi
)
}
file-select "${1:-pwd}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment