TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Shell Gamification (how I learn to use my shell aliases)

99 点作者 socmoth超过 12 年前

8 条评论

naner超过 12 年前
I sort of did the opposite. I took all my aliases that were created because I couldn't remember something (commandline switches, non-trivial tool invocations, non-trivial regexes, etc.) and just set the alias to echo the command. Whenever I'd attempt to use the alias, it would just print and I'd have to retype it by hand. Eventually I learned everything I used to have trouble remembering and have became much more fluent with command line utilities and bash.<p>I still leave convenience aliases intact. Nobody needs to be typing --color=auto every time they ls.
评论 #4868464 未加载
jerf超过 12 年前
If you want to make it so that any changes stick, you have to make it so the old way doesn't work anymore. I remapped my Caps Lock to several things over the years, but it isn't until I learned to unmap the original key that any of them stuck.<p>If you turn out not to like it, switch back.<p>It's a bit of a challenge to wrap something like 'git' with a shell script that spanks you for doing the wrong thing, but that's a good shell learning exercise.<p>A point scheme is still too diffuse and the feedback still too slow vs. It Didn't Work occurring instantly. You'd be amazed at how quickly you learn new keystrokes this way.
评论 #4867745 未加载
jayferd超过 12 年前
For aliases, convenience functions, and fancy widgets, my philosophy is one word: wait. I make myself go through the trouble of doing it the usual way for a little while. This way, I usually end up with much more domain knowledge and a much more elegant solution than if I'd rushed in to make things easier right of the bat.<p>For example, I don't have `alias gs='git status'`. Just `alias g=git` works great, and git has its own awesome alias system with tab completion that gets me the rest of it. So instead of `gs` I type `g s`, and I get tab completion on all the flags.
评论 #4868345 未加载
评论 #4872673 未加载
markdrago超过 12 年前
awesome quote from article: "Why do something reasonable when you have the opportunity to do something ridiculous?" ... explains so much code ...
评论 #4868329 未加载
columbo超过 12 年前
Here's another hackish way to do this, probably a bad idea, insert in your profile<p><pre><code> git() { if [[ $@ == "status" ]]; then echo "NOT TODAY BUB (hint, use gs)"; else command git "$@"; fi; } alias gs='git status -' </code></pre> edit: removed ' | more'
评论 #4867560 未加载
pserwylo超过 12 年前
This is cool. I am thinking of gamifying my alarm clock in the morning, so that I earn more XP by <i>not</i> snoozing, and just waking up.<p>Primarily it is a way to help give my mate some experience programming, but I also hope that it will help kick my morning alarm snoozing habit.<p>In the future, I thought it would be cool if you could just pass it new config files to allow gamifying everything. For example, if you want to kick your fast-food-for-lunch-habit, then allow the gamify-everything app to award XP and trophies for things such as "Making your own lunch for X straight days"
Dru89超过 12 年前
I love this. I'll try implementing it in my shell later this week. I've been looking for a great way to remember all of my custom aliases.
mdonahoe超过 12 年前
By far my biggest timesaver aliases are for cd-ing to commonly used directories.<p>alias ch="ch ~/Repositories/my_project/foo"<p>alias cn="cd ~/Repositories/my_other_project"
评论 #4872585 未加载
评论 #4869962 未加载