• Complain

Carl Albing - bash Idioms: Write Powerful, Flexible, Readable Shell Scripts

Here you can read online Carl Albing - bash Idioms: Write Powerful, Flexible, Readable Shell Scripts full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2022, publisher: OReilly Media, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Carl Albing bash Idioms: Write Powerful, Flexible, Readable Shell Scripts
  • Book:
    bash Idioms: Write Powerful, Flexible, Readable Shell Scripts
  • Author:
  • Publisher:
    OReilly Media
  • Genre:
  • Year:
    2022
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

bash Idioms: Write Powerful, Flexible, Readable Shell Scripts: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "bash Idioms: Write Powerful, Flexible, Readable Shell Scripts" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Shell scripts are everywhere, especially those written in bash compatible syntax, and its extremely useful to be able to understand and write them, but they can be complex and obscure. Complexity is the enemy of security, but its also the enemy of readability and understanding. With this practical book, youll learn how to decipher old bash code and write new code thats as clear and readable as possible. Your future you will thank you.

Authors Carl Albing and JP Vossen show you how to use the power and flexibility of the shell to your advantage. Youll learn how to read and write scripts like an expert, so that you can:

  • Write useful, flexible, and readable bash code...with style
  • Decode bash code such as ${MAKEMELC,,} and ${PATHNAME##*/}
  • Save time and ensure consistency when automating tasks
  • Amaze and impress colleagues with bash idioms
  • Discover how bash idioms can make your code clean and concise

Carl Albing: author's other books


Who wrote bash Idioms: Write Powerful, Flexible, Readable Shell Scripts? Find out the surname, the name of the author of the book and a list of all author's works by series.

bash Idioms: Write Powerful, Flexible, Readable Shell Scripts — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "bash Idioms: Write Powerful, Flexible, Readable Shell Scripts" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
bash Idioms by Carl Albing and JP Vossen Copyright 2022 Carl Albing and JP - photo 1
bash Idioms

by Carl Albing and JP Vossen

Copyright 2022 Carl Albing and JP Vossen. All rights reserved.

Printed in the United States of America.

Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.

OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .

  • Acquisitions Editor: Suzanne McQuade
  • Development Editor: Nicole Tache
  • Production Editor: Kristen Brown
  • Copyeditor: TK
  • Proofreader: TK
  • Indexer: TK
  • Interior Designer: David Futato
  • Cover Designer: TK
  • Illustrator: TK
  • April 2022 Year: First Edition
Revision History for the First Edition
  • 2021-09-08: First Release
  • 2021-11-03: Second Release
  • 2022-01-11: Third Release

See http://oreilly.com/catalog/errata.csp?isbn=9781492094753 for release details.

The OReilly logo is a registered trademark of OReilly Media, Inc. bash Idioms, the cover image, and related trade dress are trademarks of OReilly Media, Inc.

While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.

978-1-492-09475-3

[TK]

Preface

Websters Dictionary defines idiom as:

1 : an expression in the usage of a language that is peculiar to itself either in having a meaning that cannot be derived from the conjoined meanings of its elements (such as up in the air for undecided) or in its grammatically atypical use of words (such as give way)

2a : the language peculiar to a people or to a district, community, or class : dialect

2b : the syntactical, grammatical, or structural form peculiar to a language

3 : a style or form of artistic expression that is characteristic of an individual, a period or movement, ora medium or instrument

Why bash Idioms? One word, readability. Or perhaps a different word, understandability. In this book those words mean the same thing. We dont have to explain why thats critically important, unless this is the first book about programming you are reading , you already get it. Readability means being able to read and understand code, especially code that someone else wrote, but it also means being able to write code that you, or someone else, can later read and understand. Clearly these aspects are different sides of the same coin, so well explore both the clear idioms to use and decode the obscure ones not to.

We think of bash, informally, as a language to use to run things. If you need to do a lot of heavy data processing, bash may not be the first choice. You can do it, but it might not be pretty. Of course, if you already have the data processing tools you need and you just have to glue them together, well then bash is great. But if all we do is run things, why do we care about the idioms of the language or its structural form? Programs grow, features creep, things change and there is nothing more permanent than a temporary solution. Sooner or later someone is going to have to read the code, understand it, and make changes. If its written using an obscure idiom, the job is that much harder.

In a lot of ways bash doesnt look like other languages. It has a lot of history (some may say baggage) and there are reasons it looks and works the way it does. Were not going to talk about that very much, because we cover a lot of that in the bash Cookbook. Shell scripts arguably run the world, at least in the Unix and Linux worlds (and Linux pretty much runs the cloud world), and a huge majority of those scripts are interpreted by bash. Maintaining backwards compatibility back to the very first Unix shells is critically important, but it imposes somebaggage.

Then theres the dialects. The big one, especially for backwards compatibility, is POSIX . We wont talk too much about that either, after all this is bash Idioms, not POSIX Idioms. Other dialects may appear when programmers write bash code in a style that is more characteristic of another language they know. A flow that makes sense in C may feel clumsy or disjointed in bash though. So with this book, we intend to demonstrate a style or form of expression that is characteristic of bash. Python programmers talk about their style as pythonic. Wed like this book to illustrate and illuminate code that is bashy.

By the end of this book the reader will be able to:

  • Write useful, flexible, and readable bash codewith style

  • Decode bash code such as ${MAKEMELC,,} and ${PATHNAME##*/}

  • Save time and ensure consistency when automating tasks

  • Amaze and impress colleagues with bash idioms

  • Discover how bash idioms can make your code clean and concise

Running bash

Were going to assume you are already programming in bash, and therefor you dont need to learn where to find or install it. Of course bash is just there in almost all Linux distributions, and already there by default or installable on virtually any other operating system. You can get it in Windows using Git for Windows , or various other options we cover in the bash Cookbook.

bash on Mac

That said, watch out for stock bash on a Mac, its quite old and many newer idioms (v4+) wont work. You can obtain a newer version by installing MacPorts, Homebrew, or Fink and looking for bash. According to https://discussions.apple.com/thread/250722978 the issue is that newer versions of bash use GPLv3 which is a problem for Apple.

On a related note, https://support.apple.com/en-us/HT208050 says that macOS Catalina and newer will use zsh as the default login and interactive shell. Zsh is mostly compatible with bash, but some code in this book wont work unmodified. Bash isnt going away on Macs (yet, at least) and having Zsh as your default shell will not affect a bash shebang line, but again, unless you upgrade, youll be stuck with stone-age bash.

Weve tagged example scripts Does not work on zsh 5.4.2 as a best effort clue for Mac users, but this is a book about bash so were going to stay focused.

bash in Containers

Be careful in Docker or other containers where /bin/sh is not bash and /bin/bash may not even exist! This applies to Internet-of-Things and other constrained environments such as industrial controllers.

/bin/sh may be bash in POSIX mode, but it may also be Ash or Dash (https://en.wikipedia.org/wiki/Almquist_shell), or BusyBox (which is probably actually Dash), or maybe even something else. Youll need to be specific, and possibly either ensure that bash is actually installed, or stick to POSIX and avoid bashisms.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «bash Idioms: Write Powerful, Flexible, Readable Shell Scripts»

Look at similar books to bash Idioms: Write Powerful, Flexible, Readable Shell Scripts. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «bash Idioms: Write Powerful, Flexible, Readable Shell Scripts»

Discussion, reviews of the book bash Idioms: Write Powerful, Flexible, Readable Shell Scripts and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.