Shell Tree: Building A Shell Script for the Graphic Representation of a Directory Structure

This is a series of posts detailing different methods of printing out a graphical representation of a tree in using a bash shell script. It culminates in the building of a recursive shell script. Breaking down Dem Pilafian’s one line command to display a tree of a directory Breaking down Dem Pilafian’s script that uses…

Bash Arrays: Exploring and Experimenting with Bash Arrays

This is a series of posts exploring bash arrays, from the basics to more advanced usages. I began the series in an attempt to understand bash arrays as I was building the Shell Tree script How to declare an array and set its elements How to get the indices of an array How to cycle…

ShellTree 3: Modifying and Optimizing the One Line Command Implementation

This post is part of an educational series on building a shell script to graphically display the structure of a directory. Previously We broke down Dem Pilafian’s one line command to display a tree of a directory We broke down Dem Pilafian’s script that uses the one line command Setup Directory and Script Setup Please…

ShellTree 2: Analyzing the One Line Implementation Script

This post is part of an educational series on building a shell script to graphically display the structure of a directory. Previously We broke down Dem Pilafian’s one line command to display a tree of a directory The Script #!/bin/sh ####################################################### # UNIX TREE # # Version: 2.3 # # File: ~/apps/tree/tree.sh # # #…

Bash Recursion Examples and Experiments with Local Variables

Recursion in programming is when a piece of code (usually a function) calls itself. If there is no exit case, the program will go on forever. We will be discussing recursion in a bash script with examples and discussing some peculiarities of the bash shell, such as local variables. Setup Let’s make a shell script.…