GNU bug report logs - #66713
Expr substr on plus symbol

Previous Next

Package: coreutils;

Reported by: petabaud51 <petabaud51 <at> gmail.com>

Date: Mon, 23 Oct 2023 20:54:02 UTC

Severity: normal

Merged with 66714

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: petabaud51 <petabaud51 <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Expr substr on plus symbol
Date: Mon, 23 Oct 2023 20:54:08 +0100
Greetings,
I'm not sure if this is the intended UNIX/POSIX behaviour, but on:
< expr substr a 1 2
, I get:
> a
, which is right, but on:
< expr substr + 1 2
I get:
> expr: syntax error: missing argument after ‘2’

On expr "$line_of_text" 1 2, this error is thrown if the line is a 
simple '+'.
A real-world scenario is getting the first character of each line in 
bulk, crashing if the line is '+'.

< expr --version
> expr (GNU coreutils) 8.32

--




This bug report was last modified 1 year and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.