#!/bin/bash scriptdir="some-directory" && whereami=$(pwd |awk -F'/' '{print $NF}') if [ $whereami != $scriptdir ]; then printf "\nYou are in the wrong directory! you should be here $scriptdir\n\n"; exit; fi