跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Linux] 想维护一套自己的 dotfiles 顺便练练 Shell 编程,有没有值得参考的仓库推荐一下

发表于

Linux 五年使用经验的骨灰级入门选手,之前都是现用现查,查完就忘,主打一个能干活就行。最近经常需要连到服务器上查各种日志和配置之类,但往往服务器默认的 Shell 环境太裸了,非常难用,所以痛下决心想把这块搞定。

主要是想要能在主流 Linux 环境下快速配置,做到任何环境都有同样的命令行体验,不追求过度花里胡哨,保证最小可用性与生产力即可。

因为要在保证体验统一的前提下尽量兼顾各种可能的情况,比如一些限制比较严格的生产环境之类的,遵循奥卡姆剃刀原则,如无必要勿增实体,所以优先选择那种主流服务器发行版都一定会带的工具,相比 Zsh 会选择 Bash ,相比 Emacs 会选择 Vim 等等。

我知道有很多现成的优秀项目,比如 Oh My Zsh/starship ,但感觉这些大多是面向个人本地开发环境的,不适用于远程到生产环境的服务器做调查的场景。毕竟你总不可能为了查个日志在生产环境上搞了一大坨有的没的。

简单看过几个 GithHub 上比较有名的个人 dotfiles 仓库,例如 holmanMathias的,一个是面向 Mac ,一个用了 Zsh ,都不太理想。目前感觉 这个最合心意,但不太确定里面的写法是否符合最佳实践,比如其中的几个 util:

answer_is_yes() {
    [[ "$REPLY" =~ ^[Yy]$ ]] \
        && return 0 \
        || return 1
}

ask() {
    print_question "$1"
    read -r
}

ask_for_confirmation() {
    print_question "$1 (y/n) "
    read -r -n 1
    printf "\n"
}

...感觉 askask_for_confirmation 完全简化合并成一个函数的。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Account

导航

搜索

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.