0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

シェルの誤ログアウトを防止する

Posted at

概要

% exit

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.

[プロセスが完了しました]

う、うわあぁぁぁぁぁぁぁぁぁぁぁぁぁぁぁ!!!!!!!!
Macのターミナルを使っている人なら誰しもが経験あるのではないでしょうか?
私は普段Ctrl+Dをログアウトで使うのですが、誤入力でやってしまうことが多々あります。
そういった時の予防法です。

手順

.zshrcファイルsetopt IGNORE_EOFを追記してsource ~/.zshrcで保存するだけです。
簡単ですね。

vim ~/.zshrc
#追記
setopt IGNORE_EOF
source ~/.zshrc

追記後

追記後はCtrl+Dを入力してしまってもさらに追加でlogoutもしくはexitと入力しない限り、ログアウトできなくなります。
興味のある人はやってみてね。

% 
zsh: use 'logout' to logout.
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?