From 521eb0571eef9352c99d8e401fc8d73d626014cf Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@jwilk.net>
Date: Tue, 1 Mar 2022 17:15:45 +0100
Subject: [PATCH] script: fix passing args to execlp()

Fixes:

    $ SHELL=bash script -q -c 'echo Hello world'
    -c: echo Hello world: No such file or directory

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
---
 term-utils/script.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/term-utils/script.c b/term-utils/script.c
index c8b55c8..89bd0ed 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -975,9 +975,9 @@ int main(int argc, char **argv)
 				execl(shell, shname, "-i", (char *)NULL);
 		} else {
 			if (command)
-				execlp(shname, "-c", command, (char *)NULL);
+				execlp(shname, shname, "-c", command, (char *)NULL);
 			else
-				execlp(shname, "-i", (char *)NULL);
+				execlp(shname, shname,  "-i", (char *)NULL);
 		}
 
 		err(EXIT_FAILURE, "failed to execute %s", shell);
-- 
2.27.0

