Skip to content

Instantly share code, notes, and snippets.

@viktordw
viktordw / simple_args_parsing.sh
Created November 17, 2021 12:14 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@viktordw
viktordw / get_shell_name.sh
Created August 17, 2021 14:00
Get shell executable name
# https://stackoverflow.com/questions/23011370/how-to-recognize-whether-bash-or-dash-is-being-used-within-a-script
getTrueShellExeName() {
local trueExe nextTarget 2>/dev/null # ignore error in shells without `local`
# Determine the shell executable filename.
trueExe=$(ps -o comm= $$) || return 1
# Strip a leading "-", as added e.g. by OSX for login shells.
[ "${trueExe#-}" = "$trueExe" ] || trueExe=${trueExe#-}
# Determine full executable path.
[ "${trueExe#/}" != "$trueExe" ] || trueExe=$([ -n "$ZSH_VERSION" ] && which -p "$trueExe" || which "$trueExe")
@viktordw
viktordw / .cpanel.yml
Created August 16, 2021 11:53
primer cPanel deploy fajla.
---
deployment:
tasks:
- DEPLOYPATH="/home/$USER/public_html"
- TEMPDIR="/home/$USER/tmp/public_html"
- REPOPATH="/home/${USER}/repositories"
- rm -r $TEMPDIR; mkdir $TEMPDIR
- cp -Tar ${DEPLOYPATH}/.well-known ${TEMPDIR}/.well-known
- cp -Tar ${DEPLOYPATH}/cgi-bin ${TEMPDIR}/cgi-bin
- cp -Tar ${DEPLOYPATH}/index.phtml ${TEMPDIR}/index.phtml