Sometimes it is helpful to hide all icons on a desktop, e.g. during a presentation or if you want to focus on something and the files on desktop are disturbing. The following shell script is a solution for Max OS X.

[code language=”bash”]
if [ $1 = "true" ] || [ $1 = "false" ]
  echo "setting desktop icons to $1"
  defaults write CreateDesktop -bool $1
  killall -SIGHUP Finder
  echo "usage: $0 [true|false]" 1>&2

This is a practical example on how shell programming can support daily routines (from our operating systems class). The other examples I mentioned during today’s class were about using shell programming for batch editing large amounts of video files or pdfs.

Tagged on: