Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

sh: Add simple CDPATH test.

Obtained-from:  FreeBSD 222379
  • Loading branch information...
commit 690a7448b8b79bdbea6ae6b108ed5380a8548ccc 1 parent 1453408
authored December 25, 2011

Showing 1 changed file with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. 23  tools/regression/bin/sh/builtins/cd5.0
23  tools/regression/bin/sh/builtins/cd5.0
... ...
@@ -0,0 +1,23 @@
  1
+# $FreeBSD: src/tools/regression/bin/sh/builtins/cd5.0,v 1.1 2011/05/27 19:36:07 jilles Exp $
  2
+
  3
+set -e
  4
+T=$(mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXX")
  5
+trap 'rm -rf "$T"' 0
  6
+
  7
+cd -P "$T"
  8
+D=$(pwd)
  9
+
  10
+mkdir a a/1 b b/1 b/2
  11
+
  12
+CDPATH=$D/a:
  13
+# Basic test.
  14
+cd 1 >/dev/null
  15
+[ "$(pwd)" = "$D/a/1" ]
  16
+# Test that the current directory is not checked before CDPATH.
  17
+cd "$D/b"
  18
+cd 1 >/dev/null
  19
+[ "$(pwd)" = "$D/a/1" ]
  20
+# Test not using a CDPATH entry.
  21
+cd "$D/b"
  22
+cd 2
  23
+[ "$(pwd)" = "$D/b/2" ]

0 notes on commit 690a744

Please sign in to comment.
Something went wrong with that request. Please try again.