News for hackers. Stuff that matters.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by jodrellblank on Thursday August 11, 2022 @09:01PM (#32433702)
Which is why it makes more sense for \r\n to be the *nix line ending - because there is a distinct "carriage return (on same line)" from "line feed (at same carriage position)" operations possible, and combining them together makes carriage return and line feed to put the cursor at the start of a new line.

And why it makes more sense for \n to be the common Windows line ending because it doesn't have that TTY ancestry.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by juped on Thursday August 11, 2022 @11:31PM (#32434446)
What's even more nuts about Unix 300-layers-of-tty-emulation \n acting like a CRLF is that \r still works just fine as CR. e.g., you can get a nice little clock with:

  while true; do echo -n "  $(date)\r"; sleep 1; done
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by Athas on Friday August 12, 2022 @02:01AM (#32435123)
I need to use printf to interpret the escape character:

    while true; do printf "  $(date)\r"; sleep 1; done
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by hbossy on Friday August 12, 2022 @03:44AM (#32435621)
I like my terminals a little bit cleaner:

    printf '\033c';  while true; do echo -en "  $(date)\r"; sleep 1; done
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by schoen on Friday August 12, 2022 @02:04AM (#32435136)
It might also work with "echo -e".
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by jjjz on Friday August 12, 2022 @02:05AM (#32435142)
(don't forget "-e" for echo)

  while true; do echo -en "  $(date)\r"; sleep 1; done
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by faho on Friday August 12, 2022 @02:44AM (#32435316)
Depends on your echo. Zsh's interpretes escape sequences by default unless the "BSD_ECHO" option is used, bash's doesn't unless "xpg_echo" is on.

And xpg_echo is on by default for bash on macOS, so for users on macOS it looks like echo interprets escapes by default.

This is one of the reasons why echo is hopelessly unportable.

See https://unix.stackexchange.com/a/65819/55665

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by jrumbut on Friday August 12, 2022 @04:07AM (#32435738)
Learn something new every day!

And I wish we had a stronger word than unportable for echo. You see that word tossed around on shell scripting resources where the only system it applies to is a 30 year old version of ksh and it only blows up on a full moon when passed a filename with a literal form feed \f, but echo is a practical portability problem.

Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by Arnavion on Thursday August 11, 2022 @09:47PM (#32433943)
That would make sense except you have them the wrong way around.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by jodrellblank on Thursday August 11, 2022 @09:55PM (#32433974)
I have them the right way around, it's everyone else who has them the wrong way around.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by tbrownaw on Thursday August 11, 2022 @11:38PM (#32434477)
Sometimes when theory doesn't match reality, it's reality that's wrong.
Re:Dotfiles being hidden is a UNIXv2 mistake (2012) by Dylan16807 on Friday August 12, 2022 @01:46AM (#32435063)
I don't see anything that says which is which in that comment. Just what makes sense.