8 ms·
hr(){printf '=%.0s' $(seq $COLUMNS)}
by yoha 13y ago
hr(){printf '=%.0s' $(seq $COLUMNS)}
- sp332 13y agoWhat language is that?
- sdfjkl 13y agozsh
- sheetjs 13y agobash shell, although some whitespace is missing: hr() { printf '=%.0s' $(seq $COLUMNS); } printf is a bash builtin
- ajross 13y agoActually 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.
- sheetjs 13y agoI don't know if its still the case, but OSX used to not ship with seq. Instead, you had to use jot.
- _delirium 13y agoOSX 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.
- azinman2 13y agonice and simple! added to my .zshrc :)
- antimora 13y agoHere is a copy-n-paste to your bash prompt: function hr { printf '=%.0s' $(seq $COLUMNS); }