Docker Community Forums

Share and learn in the Docker community.

Docker Machine bash completion error

beta
docker

(Johnstarich) #1

Expected behavior

No error should be produced when bash completion runs for docker-machine. Particularly, this should not occur when no docker-machine command has been typed yet.

Actual behavior

Every bash prompt displays and then the following error is printed:

Last login: Sun Jul  3 17:51:28 on ttys001
-bash: words: bad array subscript
-bash: ((: i < : syntax error: operand expected (error token is " ")
js@Johns-MBP:tmp$
-bash: words: bad array subscript
-bash: ((: i < : syntax error: operand expected (error token is " ")
js@Johns-MBP:tmp$

Information

Docker for Mac: version: mac-v1.12.0-beta17
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/20160703-181041.tar.gz
[OK] docker-cli
[OK] app
[OK] menubar
[OK] virtualization
[OK] system
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

After removing the bash completion file from /usr/local/etc/bash_completion.d/, I was able to reproduce the problem by sourcing the completion script for docker-machine.

OS Info (latest): OS X 10.11.5
Bash/Xcode tools Info (latest, builtin command line tools):

js@Johns-MBP:tmp$ xcode-select -v # Xcode command line tools version
xcode-select version 2343.
js@Johns-MBP:tmp$ xcodebuild -version
Xcode 7.3.1
Build version 7D1014
js@Johns-MBP:tmp$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.
js@Johns-MBP:tmp$ which bash
/bin/bash

Steps to reproduce the behavior

  1. Source bash completion file for docker-machine:
    source /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion
  2. Observe error output from 1:
Last login: Sun Jul  3 18:19:30 on ttys003
js@Johns-MBP:tmp$ 
js@Johns-MBP:tmp$ 
js@Johns-MBP:tmp$ source /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion
-bash: words: bad array subscript
-bash: ((: i < : syntax error: operand expected (error token is " ")
js@Johns-MBP:tmp$ 
-bash: words: bad array subscript
-bash: ((: i < : syntax error: operand expected (error token is " ")
js@Johns-MBP:tmp$ 
-bash: words: bad array subscript
-bash: ((: i < : syntax error: operand expected (error token is " ")
js@Johns-MBP:tmp$