Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Bash Quick Start Guide

You're reading from   Bash Quick Start Guide Get up and running with shell scripting with Bash

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781789538830
Length 186 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Tom Ryder Tom Ryder
Author Profile Icon Tom Ryder
Tom Ryder
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. What is Bash? FREE CHAPTER 2. Bash Command Structure 3. Essential Commands 4. Input, Output, and Redirection 5. Variables and Patterns 6. Loops and Conditionals 7. Scripts, Functions, and Aliases 8. Best Practices 9. Other Books You May Enjoy

Upgrading Bash on macOS X

There is a special case of Bash versions for macOS X. If you are using Bash on OS X, you might notice that the version of Bash installed by default is much older than the minimum of 4.0 discussed in this book:

bash$ declare -p BASH_VERSION
declare -- BASH_VERSION="3.2.57(1)-release"

This is due to licensing changes in Bash 4.0 that were not acceptable to the operating system vendor, which leaves the version of Bash included on the system stuck at the last acceptable version. This means that, by default, your system may not have Bash 4.0 or newer, even if the system is brand new.

Fortunately, there are other ways to install Bash 4.0 or newer on a macOS X computer. One popular method is to use the Homebrew package-management system, available here: http://brew.sh/.

Follow the instructions on the Homebrew website to install it. You can then install a new version of Bash with:

$ brew install bash

You may have to include the newly-installed Bash path in the allowed list of login shells in /etc/shells before you can apply chsh to change your login shell. You may also have to adjust your terminal emulator (e.g. iTerm) to run the new version of Bash. Consult your operating system and terminal emulator documentation to learn how to do this.

You have been reading a chapter from
Bash Quick Start Guide
Published in: Sep 2018
Publisher: Packt
ISBN-13: 9781789538830
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime