#!/bin/bash case $(basename $0) in name1) echo I was called as $0 ;; name2) echo I was called as $0 ;; *) echo I was called as $0 ;; esac exit $?