当我用-0运行seq时,为什么将其视为10?我也尝试了两个参数和三个参数。
praveen@praveen:~$ seq -0
1
2
3
4
5
6
7
8
9
10
序列(GNU coreutils)8.21
比较coreutils 8.23和8.21源代码。
以-
全数字开头的选项:
if (argv[optind][0] == '-'
&& ((optc = argv[optind][1]) == '.' || ISDIGIT (optc)))
{
/* means negative number */
break;
}
但是之后-
没有考虑到:
if (seq_fast (s1, s2))
在8.23中,此问题已修复:
if (*s1 != '-' && *s2 != '-' && seq_fast (s1, s2))
您可以在FTP上获取coreutils源:http : //ftp.gnu.org/gnu/coreutils/文件为src/seq.c
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句