Skip to content
Snippets Groups Projects
Select Git revision
  • 3b9f8748f274a8380e1d060e1745d8442903f1b2
  • main default
  • develop
  • feature/arch_support
  • feature/global_refactoring
  • v1.0.0
6 results

shell

Blame
  • shell 714 B
    #!/bin/bash
    
    # Check if we are in the right place
    if [ ! -d ./services ]; then
        echo "You must run this command from the project's root folder."
        exit 1
    fi
    
    if [[ $# -eq 0 ]] ; then
        echo "Please tell me on which service to open the shell in."
        exit 1
    
    elif [[ $# -gt 2 ]] ; then
        echo "Use double quotes to wrap commands with spaces"
        exit 1
    else
    
        COMMAND=$2
        if [[ "x$COMMAND" == "x" ]] ; then
            echo ""
            echo "Executing: /bin/bash"
            echo ""
            docker-compose exec $1 sudo -i -u rosetta /bin/bash
        else
            echo ""
            echo "Executing: \"$COMMAND\""
            echo ""
            docker-compose exec $1 sudo -i -u rosetta /bin/bash -c "$COMMAND"
        fi
    
    fi