#!/bin/bash

 

 

./xxxx

 

 

試了好久,雖然知道可以用 bash 執行來解決,但是就是覺得奇怪,因為 9.04 的 bash 3.2 是沒問題的,但到了 9.10 的 bash 4.0 就不行了。
最後在這裡:Re: source command differs if in bash or sh mode 找到答案:

This is a property of bash posix mode when you don't have `.' in $PATH:

28. The `.' and `source' builtins do not search the current directory
for the filename argument if it is not found by searching `PATH'.

> This behavior is new in version 4, old version 3.2 works fine.

The bash-3.2 behavior was a bug. Its fix is listed in CHANGES:

ggg. Fixed a bug that caused a shell running in Posix mode to search $PWD for
a file specified as an argument to source/. when the file was not found
in $PATH.

    全站熱搜

    立你斯 發表在 痞客邦 留言(0) 人氣()