What method should I use to write error messages to ‘stderr’ using ‘printf’ in a bash script?

First, yes, 1>&2 is the right thing to do. Second, the reason your 1>&2 2>errors.txt example doesn’t work is because of the details of exactly what redirection does. 1>&2 means “make filehandle 1 point to wherever filehandle 2 does currently” — i.e. stuff that would have been written to stdout now goes to stderr. 2>errors.txt …

Read more

How to start tmux with several windows in different directories?

Tmuxinator is also really good for this. Basically you create setup files like so: # ~/.tmuxinator/project_name.yml # you can make as many tabs as you wish… project_name: Tmuxinator project_root: ~/code/rails_project socket_name: foo # Not needed. Remove to use default socket rvm: 1.9.2@rails_project pre: sudo /etc/rc.d/mysqld start tabs: – editor: layout: main-vertical panes: – vim – …

Read more