News for hackers. Stuff that matters.
Re:hr for your terminal by yoha on Monday February 10, 2014 @03:17PM (#7213482)
hr(){printf '=%.0s' $(seq $COLUMNS)}
Re:hr for your terminal by antimora on Monday February 10, 2014 @03:25PM (#7213538)
Here is a copy-n-paste to your bash prompt:

    function hr { printf '=%.0s' $(seq $COLUMNS); }
Re:hr for your terminal by sp332 on Monday February 10, 2014 @03:21PM (#7213509)
What language is that?
Re:hr for your terminal by sheetjs on Monday February 10, 2014 @03:24PM (#7213536)
bash shell, although some whitespace is missing:

    hr() { printf '=%.0s' $(seq $COLUMNS); }
printf is a bash builtin
Re:hr for your terminal by ajross on Monday February 10, 2014 @03:34PM (#7213619)
Actually printf is a POSIX standard shell utility. Bash happens to implement it as a builtin, but there's also a conforming copy in GNU coreutils (and presumably busybox, but I didn't check). And the syntax above is standard Bourne shell, not specifically bash.

Actually of the constructs in that, the only non-portable one is the seq tool, which (I think) is unique to coreutils.

Re:hr for your terminal by sheetjs on Monday February 10, 2014 @03:40PM (#7213655)
I don't know if its still the case, but OSX used to not ship with seq. Instead, you had to use jot.
Re:hr for your terminal by _delirium on Monday February 10, 2014 @03:50PM (#7213724)
OSX 10.9 ships a 'seq'. This particular version was written in 2005 by the NetBSD project, and its provenance is NetBSD 3.0 -> FreeBSD 9.0 -> OSX.

Fwiw, it isn't a GNUism, though GNU's version was the first widely distributed one. A 'seq' appears in some old Research UNIX editions, and also in Plan9, but not in commercial AT&T Unix or in BSD. Instead 'jot' is the traditional BSD utility. Not sure if commercial AT&T Unix (and descendants) had anything similar.

Re:hr for your terminal by sdfjkl on Monday February 10, 2014 @03:24PM (#7213532)
zsh
Re:hr for your terminal by yoha on Monday February 10, 2014 @03:27PM (#7213561)
yup, using zsh, I tend to forgot that Bash needs spaces inside brackets. This is a good reminder though:

:(){ :|:& };:

Edit: don't run this, it's a forkbomb

Re:hr for your terminal by Ujio on Monday February 10, 2014 @04:20PM (#7213920)
And double check the formatting before you tattoo it on your arm.
Re:hr for your terminal by azinman2 on Monday February 10, 2014 @03:21PM (#7213511)
nice and simple! added to my .zshrc :)