shakedown.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A community for live music fans with roots in the jam scene. Shakedown Social is run by a team of volunteers (led by @clifff and @sethadam1) and funded by donations.

Administered by:

Server stats:

264
active users

#shellscripts

0 posts0 participants0 posts today
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>In the helpful shell functions department:</p><p>(Requires <code>bc</code> to be installed)</p><pre><code>load() { local load=$(uptime |sed -E "s/^.*load averages?: //; s/,.*$//") local uname="$(uname)" local cpus if [[ $1 == -q ]]; then echo "$load" elif [[ $1 == -i ]]; then echo "$load + 0.5" |bc -l |cut -f1 -d. else case "$uname" in Linux) cpus=$(grep -c ^processor /proc/cpuinfo);; *BSD) cpus=$(sysctl hw.ncpu |tr -dc "0-9\n");; *) warn "load(): assuming 1 cpu, don't know how to get the number in \"$uname\"" cpus=1;; esac local loadPerCPU=$(echo "scale=3; $load / $cpus" |bc -l |sed 's/^\./0./') echo "$load ($loadPerCPU per processor ($cpus))" fi } </code></pre><p><a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a> <a href="https://polymaths.social/tags/unixshell" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UnixShell</span></a> <a href="https://polymaths.social/tags/shellscripts" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripts</span></a> <a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> <a href="https://polymaths.social/tags/ksh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ksh</span></a> <a href="https://polymaths.social/tags/sh" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sh</span></a></p>
R.L. Dane :Debian: :OpenBSD: 🍵 :MiraLovesYou:<p>Gotta say, I wish <a href="https://polymaths.social/tags/bash" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bash</span></a> had <code>local</code> / lexically-scoped functions, rather than having to rely on hacks like:</p><pre><code>function widget { function ___widget_parse { ... } ... unset ___widget_parse } </code></pre><p>Something like this (which does <em>not</em> currently work) would be lovely:</p><pre><code>function widget { local function parse { ... } } </code></pre><p><a href="https://polymaths.social/tags/shellscript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScript</span></a> <a href="https://polymaths.social/tags/shellscripts" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripts</span></a> <a href="https://polymaths.social/tags/shellscripting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripting</span></a></p>
Zac<p>I did a search for ‘debug bash script’ and all I got back were a series of link to pray lines and a Swiss euthanasia clinic.</p><p> <a href="https://home.social/tags/ShellScripts" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ShellScripts</span></a></p>