summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-06-28 15:41:16 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-09-07 16:11:45 +0200
commitcccf8001bd93a4b459609c3792dc679e695ed86b (patch)
tree7074791a469a1cbae64264745ddc700e168c2ec3
parent2b7289deab6a079db13540b8cb7899b230777e51 (diff)
Fix: scriptname_to_command should replace callee string
-rw-r--r--nix-utils.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/nix-utils.sh b/nix-utils.sh
index b21c4ab..382763f 100644
--- a/nix-utils.sh
+++ b/nix-utils.sh
@@ -31,7 +31,8 @@ stdout() {
# Get the command name from a script path
#
scriptname_to_command() {
- echo "$1" | sed -r "s,$(dirname ${BASH_SOURCE[0]})/$2-(.*)\.sh$,\1,"
+ callee=$([ -z "$2" ] && echo "nix-script" || echo "$2")
+ echo "$1" | sed -r "s,$(dirname ${BASH_SOURCE[0]})/$callee-(.*)\.sh$,\1,"
}
#