this lineno is not useful it is the lineno of the die func  so it will always be like if you want to make this truly awesome  then add a backtrace func which die will call and have your new switch to strict mode call  shopt  s extdebug dump trace local j n p skip func src line args a ignore dump trace  so start at skip error  backtrace most recent call is first p for n skip n funcname n do func funcname n src bash source n line bash lineno n args for j j bash argc n j do a bash argv p j args a args done p bash argc n error printf i  file s line i function s n args s n skip src line func args done 