-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
discussiondiscussion before a proposaldiscussion before a proposal
Description
In Chapter 4.3 Turning Interactive Work into a Script, the author suggests using history 6 to retrieve / show the last 6 commands in our history:
For example, we can save the last six commands to summarize_all_books.sh:
$ history 6 > summarize_all_books.sh
$ cat summarize_all_books.sh
297 for x in ../data/*.txt; do echo $x;
bash book_summary.sh $x Author; done > authors.txt
298 for x in ../data/*.txt; do echo $x;
bash book_summary.sh $x Release; done > releases.txt
299 ls
300 mkdir ../results
301 mv authors.txt releases.txt ../results
302 history 6 > summarize_all_books.sh
history 6 is probably specific to specific flavours of Unix, and is not guaranteed to work. I propose to change it to history | tail -n 6 instead:
For example, we can save the last six commands to summarize_all_books.sh:
$ history | tail -n 6 > summarize_all_books.sh
$ cat summarize_all_books.sh
- This is also consistent with the book's previous chapters (specifically in 3.8.12).
- Much like
head -6may work in some flavours of Unix,head -n 6is recommended in the book.
What do everyone think?
I'm not sure if this is a welcomed suggestion, so I didn't send in a PR but decided to open an issue instead, and maybe get some feedback as to what the authors think. If this is the wrong avenue, apologies in advance 🙏
Thank you for the work you put into this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
discussiondiscussion before a proposaldiscussion before a proposal