swcarpentry / shell-novice

The Unix Shell
http://swcarpentry.github.io/shell-novice/
Other
388 stars 975 forks source link

Pipes and Filters - sort -n works differently for each OS #1319

Open SJaffa opened 2 years ago

SJaffa commented 2 years ago

In the Filtering output section of episode "Pipes and filters" it says

We will also use the -n option to specify that the sort is numerical instead of alphanumerical

However, on Windows (Git Bash) and macOS it seems to sort numerically by default, only on Linux it sorts alphabetically so we need to use sort -n. Most of our learners are using mac or windows so would be good to note this.

milodubois commented 2 years ago

In response to @SJaffa, I am not privy of analytics concerning demographics of users of the curriculum for shell-novice, but I would say that a great deal of developers, "novice" or "seasoned" work primarily with Linux/Unix-based operating systems. Also, the implementation of Git Bash on Windows and even key management on Windows diverge in varying degrees from Linux/Unix. Perhaps, the preface for this lesson should emphasize the eventual migration to Linux/Unix (whether as VM or not) for developers. What are your thoughts?

SJaffa commented 2 years ago

In my experience teaching this course to University researchers (PhD and staff) across all disciplines, we get very few or no Linux users, probably a 50/50 split of Mac and Windows users. I don't think many of them would call themselves developers, or be aiming to become developers. This would also be useful to highlight in the teaching material because our instructors are often on Linux so would be unaware that what they are saying doesn't match the learners' experience.

bkmgit commented 2 years ago

The pre-course surveys ask what operating system attendees are using, so instructors have this information. The skills should also be transferable to Windows powershell. Leaving -n seems to cover all operating systems. This lesson primarily aims to impart skills that allow people to use the command line more effectively.

milodubois commented 2 years ago

@SJaffa this makes sense, given the intended audience. Thank you for your reply.

SJaffa commented 2 years ago

@bkmgit I think including -n in the instructions is a good idea, but I think it would be good to change the text to say something like, "You can sort alphabetically or numerically by using the appropriate flags. Note that the default sort may be different of different operating systems" Mainly to make instructors aware that students might be seeing something different, but this also helps teach the general best practice of making your code not depend on OS.