Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Midnight Commander subshell trolling guard #1

Open
midenok opened this issue Nov 15, 2013 · 1 comment
Open

Midnight Commander subshell trolling guard #1

midenok opened this issue Nov 15, 2013 · 1 comment

Comments

@midenok
Copy link
Member

midenok commented Nov 15, 2013

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 "$@"; }
@midenok
Copy link
Member Author

midenok commented Nov 15, 2013

Better solution would be suspend MC and run command in parent shell. Anyone's try to make script for this is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant