Printing shell output

14 Jun 2020

For the past two weeks I’ve been working on my most extensive open source issue to date, which came out of an error I got as I was going through the BeeWare project tutorial.

I’ve learned a lot from the experience so far, and planning to write a post eventually summarizing some of the key takeways. For the moment,just documenting to handy bash commands I’ve learned in the process & found helpful for saving script output a file and later comparing the differences across two files:

tee

Reads from standard input, writes to standard output and file

Example from project:

jchen@ribka:~/Desktop/FOSS/beeware/briefcase2/briefcase/src/macOS/Hello World/Hello World.app
/Contents/MacOS$ ./Hello\ World | tee nv_direct.txt

Run scripts, display output on console and save to file nv_direct.txt

man page for tee

diff

Display differences between two files

Example from project:

(.env) jchen@ribka:~/Desktop/FOSS/beeware/briefcase2/briefcase/src/macOS/Hello World
/Hello World.app/Contents/MacOS$ diff -y --suppress-common-lines 
no_nv_direct.txt nv_direct.txt | tee diff.txt

Compare two files & print different lines only side-by-side man page for diff