[lang-ref] ( get_executed_command_path ) ( bash )
@test "get executed command path" {
# $0 => ./a.sh
# examples/get_executed_command_path.sh
#
# #!/bin/bash
# echo $0
# examples/get_executed_command_path_call.sh
#
# #!/bin/bash
# examples/get_executed_command_path.sh
# examples/get_executed_command_path_include.sh
#
# #!/bin/bash
# . examples/get_executed_command_path.sh
r="$(examples/get_executed_command_path.sh)"
[[ "$r" == "examples/get_executed_command_path.sh" ]]
r="$(examples/get_executed_command_path_call.sh)"
[[ "$r" == "examples/get_executed_command_path.sh" ]] # subshell path
r="$(examples/get_executed_command_path_include.sh)"
[[ "$r" == "examples/get_executed_command_path_include.sh" ]] # caller path
}