Created
          November 24, 2013 19:10 
        
      - 
      
- 
        Save mlafeldt/7631064 to your computer and use it in GitHub Desktop. 
    Ask VirtualBox for current SSH port of a Vagrant machine
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | machine_name=default | |
| machine_id=$(cat ".vagrant/machines/$machine_name/virtualbox/id") | |
| ssh_port=$(VBoxManage showvminfo "$machine_id" --machinereadable | grep ^Forwarding | head -n1 | cut -d, -f4) | |
| echo $ssh_port | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment