<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="120430" data-post-id="120430">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="adrianrl" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/adrianrl/120/7182_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  adrianrl
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Don’t know if Bash has something similar, but I use Oh My ZSH and we have a good one for <code>cd</code>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">cd ..   # one directory up
cd ...  # two directories up
cd .... # three directories up and so on...
</code></pre>
<p>Come to the dark side, we have cookies and fancy plugins. <img src="https://forum.elixirforum.com/images/emoji/apple/smiling_imp.png?v=15" title=":smiling_imp:" class="emoji" alt=":smiling_imp:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120430" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-120430" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120430"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="120432" data-post-id="120432">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sanswork" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sanswork/120/39354_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sanswork
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The only things in mine at the moment are shortcuts to switch between heroku accounts, some code to set the iterm tab colour and this journal command I stole from somewhere that lets me create a daily journal on my iCloud drive.</p>
<p>My .gitconfig has a ton of shortcuts though I again stole from somewhere that have made working with branches a lot easier.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">journal() {
  mkdir -p ~/Library/Mobile\ Documents/com~apple~CloudDocs/journal/`date +%Y`
  $EDITOR ~/Library/Mobile\ Documents/com~apple~CloudDocs/journal/`date +%Y`/`date +%m-%d`
}
alias j=journal
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120432" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-120432" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120432"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="120467" data-post-id="120467">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jchrist" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jchrist
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>There’s <code>shopt autocd</code>. To quote the manpage:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">              autocd  If set, a command name that is the name of a directory is executed as if it were the argument to the cd command.
                      This option is only used by interactive shells.
</code></pre>
<p>So for instance, running <code>..</code> will put you one directory up. Doesn’t work for multiple parent directories though.<br>
There’s also other fancy options here like <code>cdspell</code> or <code>dirspell</code>. I never really looked much into all these options but I believe you can customize <code>bash</code> quite a lot using them <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120467" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-120467" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120467"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="120503" data-post-id="120503">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is how my <code>.bash_profile</code> file looks:</p>
<pre data-code-wrap="bash"><code class="lang-bash"># /etc/skel/.bash_profile

# This file is sourced by bash for login shells.  The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] &amp;&amp; . ~/.bashrc
</code></pre>
<p>Well … hello from <code>Gentoo</code>/<code>Funtoo</code> world <img src="https://forum.elixirforum.com/uploads/default/original/2X/2/20c9c52366de24191270f0b11311379ce60ac82d.gif?v=15" title=":077:" class="emoji emoji-custom" alt=":077:" loading="lazy" width="20" height="20"></p>
<p>Now seriously here is a bit of my <code>bash</code> code (can’t show all):</p>
<pre data-code-wrap="bash"><code class="lang-bash">if [[ $- != *i* ]] ; then
	# Shell is non-interactive.  Be done now!
	return
fi

# git

export EDITOR="nano"
export VISUAL=$EDITOR

# asdf base

. $HOME/.asdf/asdf.sh
. $HOME/.asdf/completions/asdf.bash

# Erlang

export ERL_AFLAGS="-kernel shell_history enabled"
export KERL_BUILD_DOCS=yes

# Elixir

ASDF_CURRENT_ELIXIR=`asdf current elixir | awk -F"(" '{print $1;}'`
ASDF_MIX_DIR="~/.asdf/installs/elixir/$ASDF_CURRENT_ELIXIR/.mix"
export PATH="$PATH:$ASDF_MIX_DIR:$ASDF_MIX_DIR/escripts/"

# Secrets

# …

# Private projects data

# …

# Aliases

alias git_branch="git symbolic-ref --short HEAD"
alias git_head_revision="git rev-parse HEAD"
alias git_number_of_changed_files="git diff --shortstat | xargs | grep -Po '\d+' | sed -n 1p"
alias git_number_of_deleted_files="git ls-files --deleted --exclude-standard | wc -l"
alias git_number_of_deletions="git diff --shortstat | xargs | grep -Po '\d+' | sed -n 3p"
alias git_number_of_insertions="git diff --shortstat | xargs | grep -Po '\d+' | sed -n 2p"
alias git_number_of_modified_files="git ls-files --exclude-standard --modified | wc -l"
alias git_number_of_others_files="git ls-files --exclude-standard --others | wc -l"
alias git_origin_url="git config --get remote.origin.url"
alias git_repo="git_origin_url | sed -E 's/^git@|^git:\/\/|^https:\/\//\\\\e[93m/' | sed 's/:/ \\\\e[94m/' | sed 's/\// \\\\e[96m/' | sed -E 's/.git$/\\\\e[39m/'"
# …

# Prompt

set_prompt_vars() {
  FULL_DATE=$(date '+\e[38;5;172m%-V\e[39m|\e[38;5;143m%-j \e[39m\e[1m%A\e[21m, \e[96m%_d %B %Y\e[39m - \e[95m%-H:%M:%S:%N \e[93m%Z\e[39m \e[38;5;244m(%-::z)\e[39m')
  GIT_INFO=""
  if git rev-parse --is-inside-work-tree &gt; /dev/null 2&gt;&amp;1
  then
  GIT_INFO="\
$(git_repo)\n\
\e[95m$(git_branch)\e[97m ($(git_head_revision)): \
\e[93m$(git_number_of_changed_files)C\e[39m-\
\e[91m$(git_number_of_deleted_files)D\e[39m-\
\e[95m$(git_number_of_modified_files)M\e[39m-\
\e[92m$(git_number_of_others_files)N\e[39m\
\e[97m | \
\e[92m+$(git_number_of_insertions)\e[39m/\
\e[91m-$(git_number_of_deletions)\e[39m\n"
  fi
  
  PROMPT_LINE="\e[32m\w \e[34m|&gt; \e[97m"
  export PS1="\n$FULL_DATE\n$GIT_INFO$PROMPT_LINE"
}
PROMPT_COMMAND=set_prompt_vars

# and so on …
</code></pre>
<p>For sure I have removed lots of parts as it’s (at least not yet) right time to show them + it’s a really long file (1200+ lines spitted into multiple script files with custom functions, aliases and so on …). <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"> Rest of my <code>~/.bashrc</code> for now is still top secret. <img src="https://forum.elixirforum.com/uploads/default/original/2X/1/126cb0df7fa700c0fc3f99aa44138904e8fa3bf1.gif?v=15" title=":icon_wink:" class="emoji emoji-custom" alt=":icon_wink:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120503" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-120503" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120503"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="159161" data-post-id="159161">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Kurisu" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Kurisu/120/14820_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Kurisu
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’m using Ubuntu and here is some of my bash setup.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># auto check dir
shopt -s autocd

# Run my custom python3 modules located at "/home/kurisu/.scripts/python3"
# $1 is the script name and the remaining params are its optional params
mypy3() {
	python3 /home/kurisu/.scripts/python3/$1 $2 $3 $4
}
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir"># Enable iex command history
export ERL_AFLAGS="-kernel shell_history enabled"
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir"># Exporting Env vars located at ~/.env
for file in "$(find $HOME/.env -maxdepth 1 -name '*.sh' -print -quit)"; do source $file; done
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir"># All Elixir/Phoenix stuff
ex="/home/kurisu/projets/elixir"
alias srv="mix phx.server"
alias isrv="iex -S mix phx.server"

alias creat="mix ecto.create"
alias migen="mix ecto.gen.migration"
alias migrate="mix ecto.migrate"
alias drop="mix ecto.drop"
alias setup="mix ecto.setup"
alias rollb="mix ecto.rollback"
alias seeds="mix run priv/repo/seeds.exs"

alias ctext="mix phx.gen.context"
alias html="mix phx.gen.html"
alias schm="mix phx.gen.schema"

alias depg="mix deps.get"
alias depc="mix deps.compile"

alias routes="mix phx.routes"

alias gtxt="mix gettext.extract --merge"
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir"># Secret adventure :)
alias dunnet="emacs -batch -l dunnet"
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="159161" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-159161" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="159161"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="159966" data-post-id="159966">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Aduril" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Aduril/120/18040_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Aduril
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I sometimes have to search for a string within a directory and the subdirectories. In these moments I rely on this little fellow:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">regrep () {
  MY_PATH=${2:-"."} # this sets path to either the second parameter or defaults to "."
  find $MY_PATH -type f -regex ".*" | xargs grep -H -c $1 | grep -v 0$
}
</code></pre>
<p>Looks stupid, but it gets the job done (and even with line number <img src="https://forum.elixirforum.com/images/emoji/apple/star_struck.png?v=15" title=":star_struck:" class="emoji" alt=":star_struck:" loading="lazy" width="20" height="20">)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="159966" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-159966" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="159966"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="160120" data-post-id="160120">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Aduril" data-post="17" data-topic="20929">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/aduril/48/18040_2.png" class="avatar"> Aduril:</div>
<blockquote>
<p>I sometimes have to search for a string within a directory and the subdirectories. In these moments I rely on this little fellow:</p>
</blockquote>
</aside>
<p>What’s wrong with <code>grep -R "pattern" some/tree</code>?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="160120" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-160120" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="160120"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="160133" data-post-id="160133">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="romenigld" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/romenigld/120/6200_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  romenigld
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I use ZSH and in my ~/.zshrc file I use:<br>
For the plugins in the folder <code>~/.oh-my-zsh/plugins/</code></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">plugins=(
         git
         zsh-syntax-highlighting
         zsh-autosuggestions
         )

#I like the POWERLEVEL9K
source $ZSH/oh-my-zsh.sh
source ~/powerlevel9k/powerlevel9k.zsh-theme
</code></pre>
<p>And I installed <code>Colors gem</code> and added this alias:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># COLORLS
#source $(dirname $(gem which colorls))/tab_complete.sh
alias lc="colorls"
alias lca="colorls -a"
alias lcd="colorls -d"
alias lcf="colorls -f"
alias lcsd="colorls --sort-dirs"
alias lcsf="colorls --sort-files"
alias lcl="colorls -l"
alias lcr="colorls --report"
alias lct="colorls --tree"
alias lcgs="colorls --gs"
alias lcgst="colorls --gs --tree"
</code></pre>
<p>and</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">
# ASDF
. $HOME/.asdf/asdf.sh
. $HOME/.asdf/completions/asdf.bash


# Enable history in IEX through Erlang(OTP)
export ERL_AFLAGS="-kernel shell_history enabled"

# Open command files for Atom app
export ELIXIR_EDITOR="sh /Applications/Atom.app/Contents/Resources/app/atom.sh"
export PATH="/usr/local/sbin:$PATH"

# for direnv to be activated it needs to be hooked into the shell.
eval "$(direnv hook zsh)"
</code></pre>
<p>and for commit something I like to do this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">$ gaa &amp;&amp; gcmsg " \
Chapter 1: My Sample Commit"
</code></pre>
<p>because on plugins of the oh-my-zsh I already have this alias:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">alias gaa='git add --all'
alias gcmsg='git commit -m'
</code></pre>
<p>and when I want to comment I just put the <code>gaa</code> and the<code> zsh-autosuggestons</code> shows me the last commit and with the arrow right I have all builded then for clean the last line on mac os I use the <code>CTRL + U</code> and erases the name of the last commit. And so stays just the <code>gaa &amp;&amp; gcmsg " \</code> with a other line for just comment. For me it’s very usefull.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="160133" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-160133" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="160133"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="160155" data-post-id="160155">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bibekp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bibekp/120/3885_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bibekp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Not a whole bunch…<br>
<a href="https://github.com/brpandey/bashrc/blob/master/.bashrc" rel="noopener nofollow ugc">bashrc</a></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">alias rm='rm -i'
alias emacs='/usr/bin/emacs'
alias dockerk='docker kill $(docker ps -aq) &gt; /dev/null 2&gt;&amp;1'
alias dockerr='docker rm -f $(docker ps -aq) &gt; /dev/null 2&gt;&amp;1'
alias dcp='docker-compose ps'
alias dcu='docker-compose up -d postgres kafka zookeeper'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="160155" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-160155" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="160155"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="160212" data-post-id="160212">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Aduril" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Aduril/120/18040_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Aduril
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="OvermindDL1" data-post="18" data-topic="20929">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>grep -R “pattern” some/tree</p>
</blockquote>
</aside>
<p>mh, good question <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"> I assume it did not work for a specific situation, then I got used to do it by find (I vaguely remeber that this snippet was part of a bigger solution once).</p>
<p>By looking at my code, I realized another embarassing mistake - it is <code>grep -n</code> of course, not <code>grep -c</code> <img src="https://forum.elixirforum.com/images/emoji/apple/confounded.png?v=15" title=":confounded:" class="emoji" alt=":confounded:" loading="lazy" width="20" height="20"> .</p>
<p>Edit:<br>
I tried a little and I think what I did not like about <code>grep -R</code> is that it also give the matching line (with <code>-o</code> only the match). I just simply want a list of occurences with path and line number.<br>
Therefore my new solution is this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">regrep () {
  grep -nR $1 ${2:-"."} | cut -d: -f1 -f2 
}
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="160212" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/whats-in-your-bashrc-zshrc/20929/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-160212" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="160212"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/20929/load_more?page=3">Load more posts (8 remaining)</a>
</div></template></turbo-stream>