#!/bin/bash # I noticed a motif in my computer usage: # # ls # cd ... # ls # vim really-long-filename.cc # # This script eliminates this, as long as you are within +/-1 directory # of the file of interest. function showls() { #files1="`ls -d *\"$1\"* ../*\"$1\"* */*\"$1\"* 2> /dev/null`" files1=$(ls -d ./* ../* */* | grep -i "$1") for f in $files1; do file -b $f | grep -i text 2> /dev/null > /dev/null && echo $f done } function showe() { vim -o -- $(showls "$1") } function showv() { view -o -- $(showls "$1") } function README() { view -o -- $(showls README) $(showls READ.ME) } function finde() { # finds = find by extension # Example: finds cc h # prints a list of all files ending with .cc or .h if [ $# -gt 0 ]; then x='' while [ $# -gt 1 ]; do x="$x$1\|" shift done x="$x$1" find . -regex '.*\.\('$x'\)$' fi }