Skip to content

Midnight Commander subshell trolling guard #1

Description

@midenok

To avoid horrible subshell trolling (when you forget and run MC under MC), you can do following dirty hack. Put this into your .bashrc:

check_mc()
{
    if [ -n "$MC_SID" ]
    then
        echo You are under mc!
    else
        "$@"
    fi
}

mc() { check_mc /usr/bin/mc "$@"; }
sudo()
{
    if [ -z "$1" ]
    then
        check_mc /usr/bin/sudo
    else
        /usr/bin/sudo "$@"
    fi
}
ssh() { check_mc /usr/bin/ssh "$@"; }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions