Way to bind ALT-F4 to exit in Bash (Bash on Ubuntu on Windows)
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
Really simple question. I know I can exit bash with "exit", CTRL-D, etc, and yes I know I'm using a Linux (sub)system, but when I'm on windows ALT-F4 is second nature. Naturally, I'm on windows when using WSL. I've managed to get it to exit when I type "`" (backtick) persistently via bashrc with a bind -x '"`":"exit"'
.
I can also get it to work per session with ALT-F4 by getting the keymap for ALT-F4 via CTRL-V, ALT-F4, (something like ^[[1;3S) and binding that to exit, but again, only for that session.
but if I use that same bind that exits per-session in my .bashrc and reload, it does not work, spitting out text (generally ;3S) instead. I know it's a trivial problem, I'd appreciate the help anyway.
Thanks
bash windows-subsystem-for-linux
add a comment |Â
up vote
3
down vote
favorite
Really simple question. I know I can exit bash with "exit", CTRL-D, etc, and yes I know I'm using a Linux (sub)system, but when I'm on windows ALT-F4 is second nature. Naturally, I'm on windows when using WSL. I've managed to get it to exit when I type "`" (backtick) persistently via bashrc with a bind -x '"`":"exit"'
.
I can also get it to work per session with ALT-F4 by getting the keymap for ALT-F4 via CTRL-V, ALT-F4, (something like ^[[1;3S) and binding that to exit, but again, only for that session.
but if I use that same bind that exits per-session in my .bashrc and reload, it does not work, spitting out text (generally ;3S) instead. I know it's a trivial problem, I'd appreciate the help anyway.
Thanks
bash windows-subsystem-for-linux
You may need to put it in.inputrc
instead of.bashrc
.
â Weijun Zhou
Jan 4 at 15:34
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Really simple question. I know I can exit bash with "exit", CTRL-D, etc, and yes I know I'm using a Linux (sub)system, but when I'm on windows ALT-F4 is second nature. Naturally, I'm on windows when using WSL. I've managed to get it to exit when I type "`" (backtick) persistently via bashrc with a bind -x '"`":"exit"'
.
I can also get it to work per session with ALT-F4 by getting the keymap for ALT-F4 via CTRL-V, ALT-F4, (something like ^[[1;3S) and binding that to exit, but again, only for that session.
but if I use that same bind that exits per-session in my .bashrc and reload, it does not work, spitting out text (generally ;3S) instead. I know it's a trivial problem, I'd appreciate the help anyway.
Thanks
bash windows-subsystem-for-linux
Really simple question. I know I can exit bash with "exit", CTRL-D, etc, and yes I know I'm using a Linux (sub)system, but when I'm on windows ALT-F4 is second nature. Naturally, I'm on windows when using WSL. I've managed to get it to exit when I type "`" (backtick) persistently via bashrc with a bind -x '"`":"exit"'
.
I can also get it to work per session with ALT-F4 by getting the keymap for ALT-F4 via CTRL-V, ALT-F4, (something like ^[[1;3S) and binding that to exit, but again, only for that session.
but if I use that same bind that exits per-session in my .bashrc and reload, it does not work, spitting out text (generally ;3S) instead. I know it's a trivial problem, I'd appreciate the help anyway.
Thanks
bash windows-subsystem-for-linux
asked Jan 4 at 13:27
Andrew Baumher
162
162
You may need to put it in.inputrc
instead of.bashrc
.
â Weijun Zhou
Jan 4 at 15:34
add a comment |Â
You may need to put it in.inputrc
instead of.bashrc
.
â Weijun Zhou
Jan 4 at 15:34
You may need to put it in
.inputrc
instead of .bashrc
.â Weijun Zhou
Jan 4 at 15:34
You may need to put it in
.inputrc
instead of .bashrc
.â Weijun Zhou
Jan 4 at 15:34
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Consulted a friend, found answer. ";3S" was added on to the end of the keybind, though neither of us are sure why.
Regardless, adding bind -x '"e[1":"exit"'
to .bashrc or .bash_aliases (assuming it exists), will do the trick. it only works from bash, (i.e., if you're in VIM or whatever, it wont exit), but it's not a text replace like standard bind, so it can be used when the line isn't empty.
Obligatory Disclaimer for those in the future who may want to replicate this: Every distro is different, so your key combo may be different. find it, update the command with your key combo, and viola.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Consulted a friend, found answer. ";3S" was added on to the end of the keybind, though neither of us are sure why.
Regardless, adding bind -x '"e[1":"exit"'
to .bashrc or .bash_aliases (assuming it exists), will do the trick. it only works from bash, (i.e., if you're in VIM or whatever, it wont exit), but it's not a text replace like standard bind, so it can be used when the line isn't empty.
Obligatory Disclaimer for those in the future who may want to replicate this: Every distro is different, so your key combo may be different. find it, update the command with your key combo, and viola.
add a comment |Â
up vote
0
down vote
accepted
Consulted a friend, found answer. ";3S" was added on to the end of the keybind, though neither of us are sure why.
Regardless, adding bind -x '"e[1":"exit"'
to .bashrc or .bash_aliases (assuming it exists), will do the trick. it only works from bash, (i.e., if you're in VIM or whatever, it wont exit), but it's not a text replace like standard bind, so it can be used when the line isn't empty.
Obligatory Disclaimer for those in the future who may want to replicate this: Every distro is different, so your key combo may be different. find it, update the command with your key combo, and viola.
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Consulted a friend, found answer. ";3S" was added on to the end of the keybind, though neither of us are sure why.
Regardless, adding bind -x '"e[1":"exit"'
to .bashrc or .bash_aliases (assuming it exists), will do the trick. it only works from bash, (i.e., if you're in VIM or whatever, it wont exit), but it's not a text replace like standard bind, so it can be used when the line isn't empty.
Obligatory Disclaimer for those in the future who may want to replicate this: Every distro is different, so your key combo may be different. find it, update the command with your key combo, and viola.
Consulted a friend, found answer. ";3S" was added on to the end of the keybind, though neither of us are sure why.
Regardless, adding bind -x '"e[1":"exit"'
to .bashrc or .bash_aliases (assuming it exists), will do the trick. it only works from bash, (i.e., if you're in VIM or whatever, it wont exit), but it's not a text replace like standard bind, so it can be used when the line isn't empty.
Obligatory Disclaimer for those in the future who may want to replicate this: Every distro is different, so your key combo may be different. find it, update the command with your key combo, and viola.
answered Jan 6 at 14:41
Andrew Baumher
162
162
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414767%2fway-to-bind-alt-f4-to-exit-in-bash-bash-on-ubuntu-on-windows%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You may need to put it in
.inputrc
instead of.bashrc
.â Weijun Zhou
Jan 4 at 15:34