diff --git a/usr.bin/seq/seq.c b/usr.bin/seq/seq.c index 2a35ef51690f..771346df1176 100644 --- a/usr.bin/seq/seq.c +++ b/usr.bin/seq/seq.c @@ -181,8 +181,9 @@ main(int argc, char *argv[]) for (step = 1, cur = first; incr > 0 ? cur <= last : cur >= last; cur = first + incr * step++) { + if (step > 1) + fputs(sep, stdout); printf(fmt, cur); - fputs(sep, stdout); prev = cur; } @@ -202,15 +203,19 @@ main(int argc, char *argv[]) } if (strcmp(cur_print, last_print) == 0 && strcmp(cur_print, prev_print) != 0) { - fputs(last_print, stdout); fputs(sep, stdout); + fputs(last_print, stdout); } free(cur_print); free(last_print); free(prev_print); - if (term != NULL) + if (term != NULL) { + fputs(sep, stdout); fputs(term, stdout); + } + + fputs("\n", stdout); return (0); }