echo "Hello World"
printf "Hello World\n"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Print only lines matching expression | |
awk -F: '/ssh/ { print } ' /etc/group | |
# Print only if field 4 matchs expression | |
awk -F: 'match($4,/ssh/) { print } ' /etc/group | |
# Print field 1 only if field 4 matchs expression | |
awk -F: 'match($4,/ssh/) { print $1 } ' /etc/group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#---------- | |
# simple-cheatsheet.sh | |
# | |
# source: https://devhints.io/bash | |
# | |
#---------- | |
# Variables | |
NAME="John" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dig +short myip.opendns.com @resolver1.opendns.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList | |
def MULTIBRANCH_JOBNAME = "project" | |
def BRANCH_NAME = "develop" | |
def MAX_TO_KEEP = 10 | |
def hi = hudson.model.Hudson.instance | |
def item = hi.getItemByFullName(MULTIBRANCH_JOBNAME) | |
def jobs = item.getAllJobs() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# help-template.sh | |
# | |
# Simple template for shell scripts | |
# | |
Help=$(cat <<-"HELP" | |
my-script — does one thing well | |
Usage: | |
my-script <input> <output> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set listchars=space:_,tab:>~ list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#-------------------------------------------------------------- | |
# perl-compile.sh | |
# | |
# Generates a binary file for Linux from a Perl file | |
# | |
# Usage: perl-compile.sh myfile.pl | |
#-------------------------------------------------------------- | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.7 | |
LABEL desc="Simple image for delivering shell script with no dependencies" | |
LABEL author="bsnux" | |
LABEL tag="1.0" | |
ADD your-script-here.sh /opt/your-script-here.sh | |
RUN apk update \ | |
&& apk add \ |