Skip to content

Commit 1c590f8

Browse files
committed
Update instructor notes after recent fixes
- grep -o is now supported on all platforms. - date -I is no longer used by default. - grep -E/-P is better explained. - date --help is on the list to be fixed. Closes #135.
1 parent 4dae3f6 commit 1c590f8

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

_extras/guide.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,19 @@ ____
1212
Librarians like handouts. To make a handout for this lesson, adapt/print from [https://librarycarpentry.org/lc-shell/reference](https://librarycarpentry.org/lc-shell/reference).
1313

1414
______
15-
## 05-counting-mining.md
15+
## Differences between platforms
1616

17-
This lesson notes that the `grep` flags `-o` and `-E` flag are not supported by Git Bash for Windows (see the callout 'Invalid option – o?'). Be prepared to manage these differences in shell behaviour between operating systems.
17+
Some of the commands used in this lesson behave differently depending on whether they are run on Git Bash for Windows, macOS X or Linux. Be prepared to manage these differences. Here are some examples from episode 5, "Counting and mining with the shell":
18+
19+
- `grep -E` on macOS X acts like `grep -P` on other platforms. On Windows and Linux, `grep -E` is halfway between `grep -P` and `grep`: it only does what `grep` can do, but uses Perl-compatible syntax to do it.
20+
21+
- The `grep` on Git Bash for Windows prior to version 2.19.0 (September 2018) did not support the `-o` flag. If someone gets an error "invalid option -- o", they are most likely trying to use one of these older versions. They should probably just skip the exercises that use it and upgrade later.
22+
23+
- The episode uses `date +%Y-%m-%d` because `date -I` is not available on macOS X.
24+
25+
- `date --help` is not available on macOS X so `man date` should be used instead.
26+
27+
As noted below, you should avoid demonstrating any more options that only work on certain platforms.
1828

1929
_____
2030
# General notes on shell
@@ -31,7 +41,7 @@ _____
3141
- is hard to troubleshoot, review, or improve
3242
- The Shell
3343
- Workflows can be automated through the use of shell scripts
34-
- Built-in commands allow for easy data manipulation (e.g. sort, grep, etc.)
44+
- Built-in commands allow for easy data manipulation (e.g. `sort`, `grep`, etc.)
3545
- Every step can be captured in the shell script and allow reproducibility and easy troubleshooting
3646

3747
## Overall
@@ -233,15 +243,7 @@ as long as learners using Windows do not run into roadblocks such as:
233243
Your particular shell may have extensions beyond POSIX that are not available
234244
on other machines, especially the default OSX bash and Windows bash emulators.
235245
For example, POSIX `ls` does not have an `--ignore=` or `-I` option, and POSIX
236-
`head` takes `-n 10` or `-10`, but not the long form of `--lines=10`. For example,
237-
in Episode 5 when you are teaching grep there is a command in an exercise to prepend
238-
dates to filenames that will rely on the `-I` option:
239-
~~~
240-
$ grep -i revolution *.tsv > results/$(date -I)_JAi-revolution.tsv
241-
~~~
242-
The `-I` option for ISO dates may not work with the date command on Mac OSX like it does from BSD through GNU.
243-
If you or your students are on a Mac and `-I` option isn't available, then you could mimic the `-I` option
244-
like this: `echo $(date +%Y-%m-%d)`
246+
`head` takes `-n 10` or `-10`, but not the long form of `--lines=10`.
245247
246248
247249
## Windows

0 commit comments

Comments
 (0)