Hacker News new | ask | show | jobs
by omeid2 2984 days ago
A comprehensive prompt is an extremely useful and an underappreciated productivity booster.

But please, when making screencast or screenshots, use a simple prompt.

Because the information included in the prompt is often not only irrelevant, it can be actively distracting and makes reading through less pleasant by increasing the required eye-movement and cognitive effort to filter out the useless content.

Small little things makes a difference.

2 comments

I wrote a script bash-for-recording for myself a few years back, for invocation by termrec, which set the window size to 80×24, set HOME to a new empty directory, set USER and NAME to dummy values (creating an actual new throwaway user account would be better here, but I was lazy), set TERM to xterm-256color (I think it was), cleared the environment (env -i) and possibly one or two other things, set a deliberately very simple and obvious prompt (which sets the title as well), cleared the screen, then finally started a nice clean bash profile.

I should pull out my old laptop or my backups and resuscitate the script.

The example at http://tty-player.chrismorgan.info/ was generated using that script.

I remembered a couple of details incorrectly, but this was my bash-for-recording script:

  #!/bin/bash

  # Start a new bash shell with a severely filtered environment and no initfile.
  if [ -z "$_BFR_RUNNING" ]; then
      env -i \
          _BFR_RUNNING=1 \
          PATH="$PATH" \
          LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
          TERM="$TERM" \
          SHELL="$SHELL" \
          USER="$USER" \
          HOME="$HOME/bfr-home" \
          LANG="$LANG" \
          bash --init-file "$0" "$@" <&0
      exit $?
  else
      unset _BFR_RUNNING
  fi

  # What remains of this file is the initfile.

  USER=user
  HOSTNAME=hostname
  PS1='\n\[\033[32;45;1m\]\w\[\033[m\]\$ '
  eval "$(dircolors -b)"
  alias ls='ls --color=auto'
This is neat! Thanks for sharing.
The prompt is so long that you can’t actually see the command being typed on mobile, asciienema just clips the stream.
You mean `asciinema`. That, my friend, is one unfortunate typo.
Ahh. That makes more sense. I took it as a bit of (very) crude humor.