You're replying to a comment by argv.

argv Permalink
March 23, 2010, 07:17

In the *BSD /bin/sh shell I use, cd - works fine to return to the previous directory. Also, cd -- will cd to $HOME.
I think the POSIX standard requires that at least the - operand should work with cd.

As for brace expansion, if you don't use a shell that has it such as bash or zsh, and can't do it quickly with seq or a printf script, then the jot utility in *BSD base distribution can do the job. It appears specifically designed for these type of tasks.

commandlinefu has a few good one-liners, but it is very Bash-centric. I'd like to see a collection of fu that's more portability-focused.

/bin/sh in vi mode is what I use as an interactive shell. I began this as an experiment, and to my surprise I never went back to another shell. I have put sh to heavy interactive use and it is more than enough, for me. The Open Group's Base Specification gives a decent list of all that vi mode can do.

When you use /bin/sh as your interactive shell, life becomes a little bit simpler, and, believe it or not, easier.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "cdrom_195": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.