Skip to content

Compilation of well written scripts that may help you in your journey as a devops/sysadmin person.

Notifications You must be signed in to change notification settings

jasonwbarnett/devops-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Jason Barnett
Aug 3, 2019
ea5382f · Aug 3, 2019

History

61 Commits
Aug 3, 2019
Feb 17, 2016
Aug 1, 2019
Aug 3, 2019
Aug 3, 2019
Jun 20, 2014
Aug 3, 2019
Aug 3, 2019
Feb 27, 2014
Dec 24, 2013
Aug 3, 2019
Aug 3, 2019

Repository files navigation

Build Status

DevOps Scripts

I created this repo to keep track of extremely useful scripts and to hopefully add some benefit to others. Please feel free to fork / contribute.

master_functions.sh functions

ask_question

Asks a question and echoes the user input.

ask_yes_no

Asks a yes/no question and echoes true or false. It will continue to ask the user for input until they respond with one of the folllwing: y, yes, n or no.

downcase

Replaces all uppercase letters with their lowercase counterparts.

#!/bin/bash

echo "Hello Motto" | downcase
# => hello motto

err_msg

This is a simple abstraction that wraps echo, higlights text in red and is redirected to stderr.

fail_msg

This is identical to err_msg except that it exits 1 after echoing the error message.

gsub

lstrip

Removes all leading whitespace. See also rstrip and strip.

#!/bin/bash

echo " Hello Motto" | lstrip
# => Hello Motto

msg

This is a simple abstraction that wraps echo.

rstrip

Removes all trailing whitespace. See also lstrip and strip.

#!/bin/bash

echo "Hello Motto " | rstrip
# => Hello Motto

strip

Removes all leading and trailing whitespace.

Whitespace is defined as any of the following characters: null, horizontal tab, line feed, vertical tab, form feed, carriage return, space.

#!/bin/bash

echo " Hello Motto " | strip
# => Hello Motto

succ_or_fail

Echoes success! or failed! based on $?.

upcase

Replaces all lowercase letters with their uppercase counterparts.

#!/bin/bash

echo "Hello Motto" | upcase
# => HELLO MOTTO

About

Compilation of well written scripts that may help you in your journey as a devops/sysadmin person.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published