Last active
May 4, 2022 12:58
-
-
Save FilBot3/cc89aecdb64309e2012a94176195f697 to your computer and use it in GitHub Desktop.
A Bash shell script that can be sourced or modified for a CI/CD like script that prints and runs the command given to the function.
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
#!/usr/bin/env bash | |
function print_and_run() { | |
# print_and_run is useful for doing CI/CD with Shell Scripts where the entire | |
# process is done in a single step. This function can be used in a single | |
# script, or it can be sourced as a function for other scripts. | |
# | |
# Parameters | |
# ---------- | |
# $@ - shell command being ran | |
# | |
# Returns | |
# ------- | |
# None | |
time_now=$(date +"%Y-%m-%d_%Z_%T:%N") | |
echo -n "[${time_now}] ${@} " | |
exec $@ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for some reason, starting
google-chrome
this way doesn't actually send it to the background like other processes I run.print_and_run "nohup google-chrome &>/dev/null &"
So, I have to figure out wtf is going on there.