Skip to content

Instantly share code, notes, and snippets.

@kotet
Last active October 20, 2020 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kotet/0a918458de46b648c0b161312659c365 to your computer and use it in GitHub Desktop.
Save kotet/0a918458de46b648c0b161312659c365 to your computer and use it in GitHub Desktop.
ディレクトリをたどってファイルのパスを得るツール
#!/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