summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.15
-rw-r--r--doc/ranger.pod3
-rwxr-xr-xranger.py3
3 files changed, 7 insertions, 4 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 2ad3d9c0..897a2969 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -711,11 +711,12 @@ This is a bash function (for \fI~/.bashrc\fR) to change the directory to the las
 visited one after ranger quits.  You can always type \f(CW\*(C`cd \-\*(C'\fR to go back to the
 original one.
 .PP
-.Vb 8
+.Vb 9
 \& function ranger\-cd {
 \&   tempfile=\*(Aq/tmp/chosendir\*(Aq
 \&   /usr/bin/ranger \-\-choosedir="$tempfile" "${@:\-$(pwd)}"
-\&   if [ \-f "$tempfile" \-a "$(cat \-\- "$tempfile")" != "$(echo \-n \`pwd\`)" ]; then
+\&   test \-f "$tempfile" &&
+\&   if [ "$(cat \-\- "$tempfile")" != "$(echo \-n \`pwd\`)" ]; then
 \&     cd \-\- "$(cat "$tempfile")"
 \&     rm \-f \-\- "$tempfile"
 \&   fi
diff --git a/doc/ranger.pod b/doc/ranger.pod
index ddd8dada..e5cd8987 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -785,7 +785,8 @@ original one.
  function ranger-cd {
    tempfile='/tmp/chosendir'
    /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}"
-   if [ -f "$tempfile" -a "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
+   test -f "$tempfile" &&
+   if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
      cd -- "$(cat "$tempfile")"
      rm -f -- "$tempfile"
    fi
diff --git a/ranger.py b/ranger.py
index 0991b451..1508b5de 100755
--- a/ranger.py
+++ b/ranger.py
@@ -23,7 +23,8 @@ if [ ! -z "$1" ]; then
 	ranger="$1"
 	shift
 	"$ranger" --choosedir="$tempfile" "${@:-$(pwd)}"
-	if [ -f "$tempfile" -a "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
+	test -f "$tempfile" &&
+	if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
 		cd "$(cat "$tempfile")"
 		rm -f -- "$tempfile"
 	fi && return 0