Giter Site home page Giter Site logo

shellove's Introduction

๐Ÿš Love

This repository is a companion to my talk at Adiecon 2020 Improving Productivity: Terminal Tricks and Unix Scripts and intended as an example of how even incredbly simple BASH scripts can save time and serve as personal documentation. The following simple script installs the following:

  • Homebrew: Package manager for OSX
  • Iterm2: Alternative to Terminal.app
  • ZSH: Alternative to BASH shell
  • Oh my ZSH!: Framework for customizing ZSH shell
  • tldr: Supplement to man pages, emphasis on examples and accessible explanations.

Adiecon 2020 Slides

Improving Productivity: Terminal Tricks and Unix Scripts

There is a super thorough Works Cited list at the end of the slide deck with tutorials and blogs that I referenced while putting together the slides. I highly recommend you check those authors out if you're setting up a MacOS dev environment and want ideas on how to customize your environment for optimal productivity and joy.

Pre-Requisite

X-Code

To test if you have xcode installed run: xcode--select --version

To install run xcode--select --install

To Run

Ensure the permissions are correct (if you get a permission error run chmod+ x shelling.sh) and run ./shelling.sh


Notes

The install script doesn't customize your configurations at all but read the works cited section in my slide deck and you can get all the info you need on customizing your installation.

The section offer examples of key scripting concepts not covered in the shelling.sh script.

According to the manual:

control operator The most common control operators in BASH are: && , ||, ;

  • Use && to join two commands on the condition that the first command is successfull
  • Use || to join two commands on the condition that the first command fails
  • Use ; to join two commands independent of the first command's return code
myAarray=( each word is an item )
for i in "${array[@]}"
do
	echo $i
done

Instantiation:

compound assignment:  myArray=( each word is an item ) 
indexed assignment: myArray[#]=<value@index>
  • Array Range: Bash arrays start at 1, not 0.

  • Looping over arrays: Use the syntax "${arrayName[@]}"

  • the @ ensures you access more than the first item & the quotes prevent unexpected splitting which may not be an issue but will be hard to troubleshoot if it is.

Passing parameters to a script is as simple as typing the parameters in a space delimited list just after the script invocation.

$ ./shelling.sh tehutgetahun zsh

From inside the script I'd be able to reference those parameters:

- Entire command: $0
- First argument: $1
- Nth argument: $n

Your .bash_profile file is responsible for configuring interactive (login) shells and your .bashrc profile configures all other profiles.

  • General convention is to write all of your configuration in the .bashrc file and source ~/.bashrc to the top of your .bash_profile.
  • If you're running zsh all you need to worry about is configuring your .zshrc file, zsh wil handle the rest.

shellove's People

Watchers

 avatar

shellove's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.