Giter Club home page Giter Club logo

effective-shell's Introduction

effective-shell

All Contributors

Release Please Version Badge Creative Commons BY-NC-SA

Text, samples and references for my 'Effective Shell' series. This website is hosted at effective-shell.com.

If you find this book useful, please do consider sponsoring me to help support my open-source work!

Introduction

This repository contains all of the content for the Effective Shell online book.

Installing the Samples

You can install the samples into your ~/effective-shell folder with this command:

curl effective.sh | sh

Or can also manually download them using from any of these locations:

The one-line shell installer is hosted at github.com/dwmkerr/effective-shell-installer

The Website

The content in this repository is built into a static site available at effective-shell.com. This site is generated using Docusaurus.

This section contains information on how to built, use and edit the site. To help you quickly edit the site, some tips are below:

Building the Website

To setup dependencies, run:

make setup

To test that TypeScript types compile, run:

make typescript-check

To serve the site locally, run:

make serve

To build the site, run:

make build

The built site is generated at ./build.

Note that the samples folder is automatically zipped up and added to the website, meaning it can be downloaded directly from:

https://effective-shell.com/downloads/effective-shell-samples.zip
https://effective-shell.com/downloads/effective-shell-samples.tar.gz

Custom Components

Custom Components to support styling are available at:

src/components

There is a live view that can be used to preview each component:

http://localhost:3000/zz-developer-guide/components

Components can be added to global scope, i.e. available in call pages, by adding to the MDXComponents.js swizzled file:

src/theme/MDXComponents.js

Versioning

The version of the site and the code is defined in the package.json file.

Releasing in managed via Release Please in the release-please.yaml workflow file.

If you need to manually trigger a release, run:

git commit --allow-empty -m "chore: release 2.0.0" -m "Release-As: 2.0.0"

Contributing

Please carefully read the Contributing Guide before working on changes.

Copyright & Licensing

All content is Copyright (©) Dave Kerr. Please get in touch by opening an issue if you have questions on copyright or licensing.

Creative Commons BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

ASCII Terminal Recordings

All terminal recordings used in this project are built using the superb 'asciinema' tool. Many thanks to Marcin Kulik for building such an excellent piece of software.

Thanks!

Thanks to the following people who have helped with reviews, comments, suggestions.

  • Andrew Bestbier, Thomas Neumann, Tam Nguyen, Rahul Maliakkal, Peter Mondlock, Samantha Baldwin, Niklas Schmuecker for the proofing, comments and suggestions
  • Ogus Ismail for helping me understand some of the nuances of word splitting and filename expansion
  • Josh Timmons for proof-reading and suggesting structural improvements as well as grammar and spelling fixes
  • Joel Schwarzmann for proofing and adding content on the Python code in the 'How to avoid shell scripting' chapter
  • Xiaoyou "Elsie" Jiang for proof-reading and improvements to Chapter 30

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Xiaoyou
Xiaoyou "Elsie" Jiang

📖 👀
Tobias Büschel
Tobias Büschel

👀
Doug Foo
Doug Foo

📖 👀
Sallah Kokaina
Sallah Kokaina

📖 👀
samhinton88
samhinton88

📖 👀
Alex Vinall
Alex Vinall

📖 👀
Joseph Knight
Joseph Knight

📖 👀
Doug Todd
Doug Todd

📖 👀
jdhzzz
jdhzzz

📖 👀
valankar
valankar

📖 👀
Denpeer
Denpeer

👀 📖
Marek Bogatzki
Marek Bogatzki

📖 👀
MWarnecke
MWarnecke

📖 👀 🐛
Spike
Spike

👀 🐛
Dong Zhou
Dong Zhou

👀 🐛 📖
Dror Maman
Dror Maman

🐛 📖 👀
Michael Chui
Michael Chui

👀
Saroj Sangphongamphai
Saroj Sangphongamphai

👀
Lee Li
Lee Li

👀 🐛 📖
Lee Li
Lee Li

🐛
Trevor Brown
Trevor Brown

🐛 👀

This project follows the all-contributors specification. Contributions of any kind welcome!

effective-shell's People

Contributors

adityasaxena avatar alexvinall avatar allcontributors[bot] avatar ben-nathanson avatar chapeupreto avatar denpeer avatar devonliu02 avatar drormaman avatar dwmkerr avatar github-actions[bot] avatar gumnos avatar haignalbandian avatar jdhzzz avatar josephfknight avatar leeli0 avatar louislefevre avatar mbogatzki avatar michaelwarnecke avatar moritzreiter avatar nimid avatar nosarthur avatar piotr1215 avatar rimenes avatar samhinton88 avatar spike-leung avatar stratus3d avatar tobiasbueschel avatar valankar avatar volcic avatar zambrella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

effective-shell's Issues

bug: minor issues in the `grep` chapter

On zsh systems the history file might be smaller. Replace ~/.bash_history with $HISTFILE

Let's break this down. First, we use the -E flag to tell grep to use Extended Regular Expressions. This allows us to use some clever constructs to search for text.

I know what you want to say, but factually this is wrong. You can use history | grep "[0-9]+ man" to achieve exactly the same effect ('use some clever constructs').
Suggestion: Use the history | grep "\[0-9\]+ man" version first, explain briefly it's a different dialect and then introduce the '-E' switch to get back to familiar territory (history | grep -E "[0-9]+ man").

For familiar uses, grep becomes a

Potential typo. 'users'?

question: how to handle samples

Should we have a samples folder everyone can clone to follow along with?

And then all screenshots can be based on this sample folder?

And should we show this using Windows or Linux or Mac? Or alternate between them all?

Add a chapter on different shells (& plugin managers)

There are a lot of shells out there which can be a difficult landscape for newcomers to navigate. And while bash, zsh and powershell are popular and well known, there are also many others around: https://en.wikipedia.org/wiki/Comparison_of_command_shells

Perhaps adding a chapter on the history, a small comparison and practical examples could be useful? + once you get deeper into some of these shells you might also want to look into plugin managers e.g. for zsh - zplugin, antigen, antibody, zgen, zplugin, etc.

feat: Summaries for each Section

Summaries for each section, highlighting what has been covered. This is also for people who want to skip a section, and just skim what was covered.

feat: introduction

The introduction states at the moment that the book is for anyone who uses a shell regularly. In fact, given the most recent structure it is actually for anyone. So the introduction should be updated to explain that it is more generally useful.

feat: Overview for each Section

Describes who should read it, what you will learn, and any pre-requisites. Make each section header in the TOC a link to the overview.

build: find a better way to release the 'playground'

The playground is the folder effective-shell-playground and has all of the files used in the samples etc. It would be great to be able to publish this as an artifact, or even just stick it on the website in a known location on deployment, so anyone can just curl or wget it down.

Actually, zipping it and sticking it on the website is probably the best way, rather than faffing with release tags or additional artifacts.

bug: slugs are not used for addresses

This is not the most pressing thing in the world, but is a little annoying. I would like to have clean addresses when the structure is complete, just makes it a bit easier for sharing and cleaner. And changing is painful when the page already has disqus comments.

question on the shell scripting, loops chapter

In the C style loops section, there is this paragraph.

This loop structure uses three arithmetic expressions to run the loop. The first is in 'initialise' expression, this is typically used to setup the initial state of the loop. The second is the 'conditional' expression, this is used to check whether the loop is complex. The third is the 'iterate' expression, this is evaluated after the loop commands are completed.

Why is complex used here? Is it a typo?

feat: Shell Posters

Could be interesting to look into Shopify/Printify as an option to sell physical prints of the shell 'fly on the command line' poster or other reference posters.

bug: Markdown is being interpreted incorrectly.

I haven't tracked down the root of the issue, but this line

This is better - we've eliminated some invalid addresses, _test123.effective-shell.com_, _@yahoo.com_ and _dave@_.

is being interpreted incorrectly by Docusaurus. Specifically, [email protected]_ is generating a non-italicized, valid [email protected] email address as a mailto link. GFM is handling it fine, though.

It's a very minor issue, but it detracts from the point of the sentence. I can imagine fixing it by choosing a different bit of formatting, or perhaps adding a leading space, but I'm not familiar with Docusaurus' quirks, so it's hard to advise a solution.

feat: Build up a better library of text files

For work with grep, awk, tr and so on, it would be useful to have some larger and more complex text files. We want files to demo:

  1. Things like error logs (which we grep)
  2. (add more details as needed)

"Delete"-Commands in "Navigating the Command Line" do not actually (only) delete

In the "Navigating the Command Line" section, there are a bunch of commands described as "deleting" things. Also in [website/content/docs/section1/1-navigating-the-command-line/images/command-line.png the image] commands are subdivided into "Move" and "Delete".

The thing is, readline does not actually delete! More accurately, does "not only" delete: it rather kills (comparable to an—enhanced—cut command).

The short version is that, as a result of killing instead of merely deleting, you can later yank the killed text back (comparable to paste). (The longer version is that there exists a kill ring and that opens up a whole other can of worms. :-) But it's awesome! And worth mentioning! At the very least, "delete" is simply … too simplistic. ;-) )

feat: Installing WSL

Would be useful to include a guide on how to install the Windows Subsystem Linux.

feat: Quick Samples Download Script

Would be cool to be able to:

curl effective-shell.sh/playground | bash

To get the samples!

For the book, we should also decide definitively where the sample or playground live (e.g. ~/effective-shell), this will make all of the samples easier.

feat: Chapter 7 Improvements

stdin is short for ‘standard input’ - it's where many programs read their input from
stdout is short for ‘standard output’ - it's where many programs write their output to
stderr is short for ‘standard error’ - it's where some programs write error messages to
The wording feels strange. What does 'some' / 'many' mean? Is this relevant?

I would rather write something like

"stdout" - intended for regular output
"stderr" - intended for error messages
(annotation: Some programs don't follow this convention, e.g. )
Since this is beginner-level documention I'd stick with the intention.
You could offer an 'advanced example' (using grep -v) to ignore output from misbehaving programs.


tangent: You could elaborate why piping in memory is better then writing to files. (-> no need to clean up afterwards!)

Redirect it into the file with descriptor (&) 1 - which is standard output
Could be more clear on what the ampersand is doing. (Maybe add an annotation that 2>1 would redirect into a file with name '1'. This would hopefully stick and help users debug if their command doesn't do what it should, but '1' files are showing up in their directory.)


Another bonus - pipelines save intermediate files from being created


I think it also would be worthwhile to note the example on piping stderr and stdout to a single file. Why the following doesn’t work and does work, respectively.
sh script.sh 2>&1 >> log_file.txt # Doesn't work
sh script.sh > log_file.txt 2>&1 # Does work


head -100 5_GB.csv > small_manageable.csv


Note some common conventions for stdin, e.g.:

These notes above might also go into the 'weird stuff' chatper (i.e. the chapter on things which are not consistent and are gotchas)


Consider a section on <<<:

https://unix.stackexchange.com/questions/572424/retrieve-both-http-status-code-and-content-from-curl-in-a-shell-script

Maybe a chapter 'advanced redirection?'


Grep should be an example for output, with a link to a later chapter.

I would like to contribute

Hello!

I've been reading this repository and I really appreciated. I would like to contribute by translating to portuguese (Brazil). I think this would be a good improvement for this project.

theme: Smaller Copyright Text, Show Build SHA

A little thing - would be nice to make the copyright text smaller and maybe show the current git sha at the bottom of the page (to debug if the right version is loaded in the browser)

rfc: should each chapter lead with questions

If you look at a title like 'The If Statement' the chapter seems boring.

But what about if the chapter started with:

By the end of this chapter you'll know why:

  • You should put quotes around variables in an if statement
  • The magic shell syntax to write a test command with just two characters

I.e. not giving the game away, but hinting to new and advanced users what they might discover.

bug: Chapter 8 - readline on Node

In Chapter 8 - The Power of Readline: It lists the Node.js REPL as an example of a program that uses GNU Readline, but Node actually uses it's own JS parser which ignores the .inputrc file. If you need alternative example, Ruby's REPL (irb) uses Readline.

feat: Improve Chapter 2 with the 'ls -a' flag

feat: Explicitly target Bash and ZSH

Need to make it clear in the intro, front cover and back cover that this is for both Bash and ZSH (as ZSH is the default on MacOS and I believe also one or two Linux distros).

Then in any place where the functionality will differ, use a box to call out the differences. But make it clear that the demos work the same for both shells unless otherwise stated.

bug: Chapter 12 - terminal terminology

In Chapter 12 - The Terminal: This might be a bit pedantic, but terminal programs usually refer to themselves a 'terminal emulator' to distinguish themselves from a hardware terminal.

feat: contributor guide

Setup an appropriate contributor guide. This will need to take into account the license, and detail how copyright and contributions work. Until this is completed contributions should not be taken as I'm not sure of the licensing issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.