14

Can someone clarify: 'case ":$PATH:" in' in script?

view full story
linux-howto

http://unix.stackexchange.com – I am not an expert at Unix scripting. An answer to another question suggests using the following piece of code in a script: case ":$PATH:" in *:$HOME/mydir:*) echo it is in the path;; *) echo not there ;; esac The purpose of this code is to check whether $HOME/mydir is in $PATH, but the examples in this and this suggest exact 'matching' rather than 'contains'. How is 'case' operating here? Thanks. (HowTos)