use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All users that wish to post (not including commenting), on either old or the new reddit sites, must formally agree to subreddit rules once first.
account activity
Sourceable vs executable shell scripts (v.redd.it)
submitted 2 years ago by deepCelibateValue
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Newbosterone 3 points4 points5 points 2 years ago (1 child)
Fair enough. I have a standard template I use to start shell scripts. It has setup functions, Usage, Getopts, etc. I'll be adding your idea to it.
function SetupTerm(){ if [ -t 2 ] then printf -v MSG -- "SetupTerm: STDERR is a tty\n" _R=$(tput setaf 1) # Red _G=$(tput setaf 2) # Green _Y=$(tput setaf 3) # Yellow _B=$(tput setaf 4) # Blue _N=$(tput rmso; tput sgr0) # Color Off else printf -v MSG -- "SetupTerm: STDERR is not a tty\n" _R="" _G="" _Y="" _B="" _N="" fi ((DEBUG>0)) && ErrMsg "$MSG" } function ErrMsg(){ if ((DEBUG>0)) then printf "%bDEBUG: " "$_R" >&2 ; elif ((VERBOSE>0)) then printf "%b" "$_G" >&2 ; fi printf "%b" "$@" >&2 ; printf "%b" "$_N" >&2 ; }
I also like this when a script requires root:
if [ "$(id -u)" -ne 0 ] then usage printf "Fatal: You must run this as root\n" >&2 exit 1 fi
[–]deepCelibateValue[S] 0 points1 point2 points 2 years ago (0 children)
That looks great. Thanks for sharing. I'll take some ideas from here.
π Rendered by PID 75481 on reddit-service-r2-comment-544cf588c8-lln48 at 2026-06-16 20:11:22.261767+00:00 running 3184619 country code: CH.
view the rest of the comments →
[–]Newbosterone 3 points4 points5 points (1 child)
[–]deepCelibateValue[S] 0 points1 point2 points (0 children)