OILS / spec / cdable-vars.test.sh View on Github | oils.pub

25 lines, 13 significant
1## compare_shells: bash
2
3#### cdable_vars: resolve variable to path
4shopt -s cdable_vars
5export TARGET_DIR='/tmp'
6cd TARGET_DIR
7pwd
8## status: 0
9## STDOUT:
10/tmp
11/tmp
12## END
13
14#### cdable_vars: fails when shopt is off
15shopt -u cdable_vars
16TARGET_DIR='/tmp'
17cd TARGET_DIR
18## status: 1
19
20#### cdable_vars: Fails if variable points to a file, not a directory
21shopt -s cdable_vars
22touch my_file
23VAR_NAME='my_file'
24cd VAR_NAME
25## status: 1