s3-bash 로컬 환경 (OS X 10.10.1
)에서 실행할 때 ubuntu server 14.04.1
에서 실행할 때 아무런 문제가 없습니다.Bash 언 바운드 변수 배열
./s3-common-functions: line 66: temporaryFiles: unbound variable
./s3-common-functions: line 85: temporaryFiles: unbound variable
나는 s3-common-functions
스크립트에서 검토 한 변수가 제대로 초기화 보인다 (배열 등) : 다음과 같은 오류 얻을
# Globals
declare -a temporaryFiles
을하지만 노트 주석에있다, 관련성이있는 경우 확실합니다.
에temporaryfiles
declare -a temporaryFiles
에 대한 배열의
# Do not use this from directly. Due to a bug in bash, array assignments do not work when the function is used with command substitution
function createTemporaryFile
{
local temporaryFile="$(mktemp "$temporaryDirectory/$$.$1.XXXXXXXX")" || printErrorHelpAndExit "Environment Error: Could not create a temporary file. Please check you /tmp folder permissions allow files and folders to be created and disc space." $invalidEnvironmentExitCode
local length="${#temporaryFiles[@]}"
temporaryFiles[$length]="$temporaryFile"
}
'언 바운드 변수 '는'set -u'를 사용할 때 얻을 수있는 것입니다. 스크립트를 실행하는 환경이 무엇이든간에 설정 했습니까? –
이 오류의 원인이되는 명령은 무엇입니까? –
버그? 댓글 텍스트에 설명 된 내용은 버그가 아니지만 정상적이고 예상되는 동작입니다. 'foo = $ (bar)'는 서브 쉘에서'bar'를 실행하기 때문에 ** 서브 쉘 내부에서 수행되는 ** 할당은 부모 쉘에 전파되지 않습니다. –