mrzool / bash-sensible Goto Github PK
View Code? Open in Web Editor NEWAn attempt at saner Bash defaults
Home Page: https://github.com/mrzool/bash-sensible/blob/master/sensible.bash
License: MIT License
An attempt at saner Bash defaults
Home Page: https://github.com/mrzool/bash-sensible/blob/master/sensible.bash
License: MIT License
I tend to use a separate .inputrc
file but you can of course put these in bind
commands like you're already doing from the bashrc... Here are two of my favorites:
# From http://www.ukuug.org/events/linux2003/papers/bash_tips/
# Incremental searching with Up and Down
"\e[A": history-search-backward
"\e[B": history-search-forward
e.g. so typing ssh <up arrow>
searches through prior ssh
commands rather than your entire command history.
The link to Bash Completion in the wiki is not found.
http://bash-completion.alioth.debian.org/
I love the idea of this project and appreciate the great defaults it gives me. Thank you.
To make the project even better I propose to split the defaults into "bash-sensible and "inputrc-sensible" for two reasons:
~/.inputrc
(e.g. I have set show-all-if-ambiguous off
in my .inputrc
which is overwritten by bash-sensible. Thus, I need to set it a second time in .bashrc
after loading bash-sensible.)I'll try to contribute in free-form style:
set -o noclobber
shopt -s checkwinsize
stty -ixon
PROMPT_DIRTRIM=2
. /usr/lib/git-core/git-sh-prompt
PROMPT_COMMAND='_status=$?; [[ $_status == 0 ]] || echo -e "\e[4mExit status: $_status\e[m"; '$PROMPT_COMMAND
When I scp to a host that I've added the sensible.bash to my ~/.bashrc, I see bind warnings.
/home/matt/bin/sensible.bash: line 28: bind: warning: line editing not enabled
I placed the binds in a TTY detection block like explained here: https://superuser.com/questions/892658/remote-ssh-commands-bash-bind-warning-line-editing-not-enabled
if [ -t 1 ]
then
# standard output is a tty
# do interactive initialization
# Enable history expansion with space
# E.g. typing !!<space> will replace the !! with your last command
bind Space:magic-space
...
fi
Works well for this.
What about disabling scroll lock (XOFF), to avoid people puzzling why the screen is frozen, having to find out about Ctrl-S and scroll lock and hitting Ctrl-Q to "unfreeze"?
I've been using this for years in my bashrc, but I don't know how portable it is:
# disable terminal locking
bind -r '\C-s'
stty -ixon
Just feedback: it would be great to have an option to log cmd history to syslog.
Some options:
https://sysadmin.compxtreme.ro/how-to-log-bash-history-with-syslog/
https://www.thegeekdiary.com/how-to-log-all-bash-history-commands-to-syslog-var-log-messages-in-centos-rhel/
Feel free to close this, just wanted to give some feedback.
I wanted to point out to you and perhaps anyone else to mathiasbynes dotfiles. Its a great community maintained set of configs. It has a much larger scope than your project, however it may be a great resource for you to draw on a "sensible" set of options. Or just a place to point people to when their suggestions fall outside "sensible" defaults.
In particular:
because I didn't remember what the strftime formats %F
& %T
were from memory. Perhaps just replacing "useful timestamp" with "standard RFC3339 timestamp".
and the readme might link to https://tools.ietf.org/html/rfc3339
You might want to update your readme.md to suggest that OSX users upgrade to bash 4.x
This worked for me (obviously need homebrew installed first).
brew install bash;echo /usr/local/bin/bash|sudo tee -a /etc/shells;chsh -s /usr/local/bin/bash
Just wondering why HISTIGNORE is exported while none of the other variables are.
My inclination is to say HISTIGNORE should not be exported since it seems bash specific and subprocesses won't use it.
What is the recommended version of bash-completion?
brew install bash
)With bash-completion 1.3 (brew install bash-completion
), I'm getting the following error:
-bash: shopt: dirspell: invalid shell option name
With bash-completion 2.1 (brew install bash-completion2
), I'm getting the following errors:
-bash: shopt: dirspell: invalid shell option name
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
-bash: complete: -D: invalid option
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
The-dead-link for bash completion. The package is said to be required but the link is dead. Maybe this is the proper updated link?
"%F %T" looks like a decent timestamp format to me, but it's not an ISO8601 timestamp, that would be "%FT%T". Suggest you remove the reference to the standard there.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.