When editing a bash script with nested " and ` marks the color coding gets confused, coloring most text as a string. Sample code to reproduce the color coding follows (this code is debugged and runs as expected, so syntax should be ok) #!/bin/bash function list-dir { cat "$repo"/list } function init-repo { mkdir -p "$repo" touch "$repo"/list } function save-dir { init-repo dirname="`basename "$1"`" dirhash="`dir-to-repo "$1"`" saveline="$dirhash $dirname" if [ "`grep -Fc "$saveline" "$repo"/list`" -gt "0" ]; then echo "A directory with the same name and content is already in the repository." exit else echo "$saveline" >> "$repo"/list fi } In GNU Emacs 22.1.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2008-05-02 on king, modified by Ubuntu Windowing system distributor `The X.Org Foundation', version 11.0.70000000 configured using `configure '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.1/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 locale-coding-system: utf-8 default-enable-multibyte-characters: t Major mode: Shell-script Minor modes in effect: tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t Recent input: C-k C-k C-k C-s f i l e - n a m e b a s e n a m e C-s C-s b a s e n a m e C-s C-s b a s e n a m e C-s C-s b a s e n a m e C-s C-s C-s C-s C-s C-s C-g C-g C-s b a s C-g C-g C-s b a s e C-s C-s C-s C-s C-x C-s C-w C-k C-x C-s M-x r e p o r t - e m a Recent messages: Quit [4 times] Mark set Mark saved where search started Mark set [4 times] call-interactively: End of buffer [2 times] Mark set [2 times] Wrote /sr/path/store Mark set Wrote /sr/path/store Loading emacsbug...done