mstdn.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A general-purpose Mastodon server with a 500 character limit. All languages are welcome.

Administered by:

Server stats:

17K
active users

#bashalias

2 posts2 participants0 posts today
Neil :emacs: :orgmode:<p>Useful alias I use all the time...</p><p>```<br>export ymd='date +%Y%m%d'<br>```</p><p>I can then use it when I want to create directories/files that are date stamped...</p><p>```<br>mkdir something-$(ymd)<br>```</p><p><a href="https://fosstodon.org/tags/bash" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>bash</span></a> <a href="https://fosstodon.org/tags/alias" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>alias</span></a> <a href="https://fosstodon.org/tags/BashAlias" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>BashAlias</span></a></p>
Norm<p>I have a <a href="https://fosstodon.org/tags/Bash" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Bash</span></a> alias (actually a function) for `git clone` that sets my <a href="https://fosstodon.org/tags/git" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>git</span></a> config username and email address based on a prompt (I can select between various accounts/SSH keys I have).</p><p>I now want to do a similar thing for `git init`. Is there an easy way to call the same bash code for the prompt and setting git config values without duplicating it all between my two functions?</p><p>AFAIK bash functions cannot return values (e.g. my chosen username/email)...</p><p><a href="https://fosstodon.org/tags/BashAlias" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>BashAlias</span></a> <a href="https://fosstodon.org/tags/Linux" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Linux</span></a> <a href="https://fosstodon.org/tags/coding" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>coding</span></a> <a href="https://fosstodon.org/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a></p>