Skip to content

Instantly share code, notes, and snippets.

View jmeubank's full-sized avatar

John E. jmeubank

View GitHub Profile
@mikeslattery
mikeslattery / x-platform.sh
Last active January 30, 2023 15:44
Cross Platform Bash Snippet for Linux, WSL 1, Cygwin, Msys, and GitBash.
#!/bin/bash
# shebang added only to appease shellcheck
# Cross-platform for bash.
# Worry less about when writting a script that must run on Windows and Linux.
# Meant to be used with "source" command in scripts or .bashrc/.zshrc
export USER="${USER:-${USERNAME:-$(whoami)}}"
export USERNAME="${USERNAME:-$USER}"
export HOSTNAME="${HOSTNAME:-${MACHINENAME:-$(hostname)}}"