From 107996e296a559688f735b1d97eb86eb58fa8dd7 Mon Sep 17 00:00:00 2001 From: Yi-Yo Chiang Date: Tue, 30 Aug 2022 17:39:10 +0800 Subject: [PATCH] Support tail +123 Old style of saying "tail -n +123". Change-Id: Ifaf78eb1d8611536a9e3428081009a55aea4ce47 --- toys/posix/tail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toys/posix/tail.c b/toys/posix/tail.c index 8a7d6d84..f9aabb32 100644 --- a/toys/posix/tail.c +++ b/toys/posix/tail.c @@ -289,8 +289,8 @@ void tail_main(void) if (!FLAG(n) && !FLAG(c)) { char *arg = *args; - // handle old "-42" style arguments, else default to last 10 lines - if (arg && *arg == '-' && arg[1]) { + // handle old "-42" / "+42" style arguments, else default to last 10 lines + if (arg && (*arg == '-' || *arg == '+') && arg[1]) { TT.n = atolx(*(args++)); toys.optc--; } else TT.n = -10; -- 2.39.2