It's not trying to get the current directory, it's trying to get the directory that contains the script. $0
is the name of the script, and the %/*
modifier removes everything from the last /
in it.
This script expects somefile
to exist in the same directory that the script is installed in, not your current directory.