From 4f6edb554e447eb8e10143879be6306e172630f3 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Mon, 28 Oct 2019 12:53:36 +0200 Subject: Apply requested changes to ranger.py and enforce full POSIX compliance --- examples/bash_automatic_cd.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/bash_automatic_cd.sh b/examples/bash_automatic_cd.sh index 4e505327..5ba9d942 100644 --- a/examples/bash_automatic_cd.sh +++ b/examples/bash_automatic_cd.sh @@ -7,11 +7,10 @@ # To undo the effect of this function, you can type "cd -" to return to the # original directory. -ranger-cd() { - local temp_file chosen_dir - temp_file="$(mktemp -t "${0}.XXXXXXXXXX")" +ranger_cd() { + temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")" ranger --choosedir="$temp_file" -- "${@:-$PWD}" - if chosen_dir="$(cat "$temp_file")" && [ -n "$chosen_dir" ] && [ "$chosen_dir" != "$PWD" ]; then + if chosen_dir="$(cat -- "$temp_file")" && [ -n "$chosen_dir" ] && [ "$chosen_dir" != "$PWD" ]; then cd -- "$chosen_dir" fi rm -f -- "$temp_file" -- cgit 1.4.1-2-gfad0