News for hackers. Stuff that matters.
Re:Bash Academy by AdmiralAsshat on Tuesday December 15, 2015 @09:27AM (#10737878)
As opposed to improper bash? Get off your high horse.

There is very much a bad way of doing bash. When I first started doing bash scripts, most of them looked like this:

cat file | grep string

cat file | wc

cat file | while read line

Multiple problems there. Then there was my initial attempts at finding files in a directory:

for i in `ls *`

This is when I learned about globbing.

There is enough variance in how things can be done in Bash with varying degrees of effectiveness that Google even has a Shell Style Guide: https://google.github.io/styleguide/shell.xml

Re:Bash Academy by m0nty on Tuesday December 15, 2015 @10:15AM (#10738177)
We all get tricked by the "useless use of cat" thing occasionally :)
Re:Bash Academy by drivers99 on Tuesday December 15, 2015 @01:00PM (#10739271)
I'm not so sure it is so useless. Consider when you want to "grep something access.log". Then you want to look at yesterday's so it's "grep something access.log.1". Then you want to look at the log before that, but it's compressed. "gunzip -c access.log.2.gz | grep something". (Ignore zgrep for the moment. Let's say I want to use grep's -A and -B options to show context of the lines that it finds.) To switch between the compressed and uncompressed files, you have to move the filename to a completely different part of the command, which requires more re-typing. You would have been better off starting with so-called "useless" cat. Separate out the concern of "putting a stream into the pipe" from "doing something with the stream". gunzip -c is just one command that might produce output.
Re:Bash Academy by joepvd on Tuesday December 15, 2015 @09:38AM (#10737939)
Thanks for the link to the Google Bash Style Guide. A good read.
Re:Bash Academy by nomadictribe on Tuesday December 15, 2015 @10:08AM (#10738117)
https://google.github.io/styleguide/shell.xml my fx doesn't render the site properly it's just one huge blob of continuous text. impossible to read. why would they do it as an *.xml?
Re:Bash Academy by narrowrail on Tuesday December 15, 2015 @12:28PM (#10739025)
Re:Bash Academy by coldpie on Tuesday December 15, 2015 @10:20AM (#10738223)
It's an XSL document. I guess your browser settings block using XSL stylesheets to render the XSL document correctly.