YaK:: bash stuff [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   
[mega_changes]
[photos]

bash stuff

 15 alias _=". $HOME/.bash_profile"
 16 alias ll="ls -l"
 17 alias lf="ls -FAC"
 18 alias m=less
 19 alias j=jobs
 20 alias ..="cd .."
 21 alias +x="chmod +x"
 22 alias i="egrep -i"
 23 alias ,="pushd"
 24 alias ,,="popd"

 47
 48 alias hh="history 22"
 49 alias hhh="history 44"
 50 alias hhhh="history 88"
 51 h() {
 52   case "$*" in
 53     [-0-9]* )
 54       history "$@" ;;
 55     "" )
 56       history ;;
 57     * )
 58       history | egrep "$@" ;;
 59   esac
 60 }

 63 p() {
 64   "$@" 2>&1 | less -i
 65 }

107 #alias ]C='git commit -a -m'
108 #alias ]a='git add'
109 #alias ]b='git branch'
110 #alias ]d='git diff'
111 #alias ]o='git checkout'
112 #alias ]l='git log --format=oneline'
113 #alias ]s='git status'
114


 20 HISTSIZE=1000
 21 HISTFILESIZE=2000

 16 # append to the history file, don't overwrite it
 17 shopt -s histappend

 23 # check the window size after each command and, if necessary,
 24 # update the values of LINES and COLUMNS.
 25 shopt -s checkwinsize

 88 # some more ls aliases
 89 alias ll='ls -alF'
 90 alias la='ls -A'
 91 alias l='ls -CF'


/home/strick/bin/\]
     1        case $# in
     2          0) git branch && echo "Lines diff: $(git diff | wc -l)" ;;
     3          1) git checkout "$1" ;;
     4        esac

/home/strick/bin/b
     1        #!/bin/sh
     2
     3        ( echo "scale=6"
     4          echo " $*"
     5        ) | bc

/home/strick/bin/g
     1        #!/bin/sh
     2
     3        exec egrep --color=auto "$@"

/home/strick/bin/n
     1        exec cat -nv "$@"

/home/strick/bin/p
     1        "$@" 2>&1 | less -i

/home/strick/bin/r
     1        #!/bin/sh
     2
     3        exec egrep -r --color=auto --exclude-dir=RCS --exclude=*,v "$@"

/home/strick/bin/v
     1        #!/bin/bash
     2
     3        N=$( expr match "$1" '.*\([:][0-9][0-9]*\).*' )
     4        F=$( expr match "$1" '\(.*\)[:].*' )
     5
     6        if test ! -z "$N"
     7        then
     8          vi +"$N" "$F"
     9        else
    10          vi "$@"
    11        fi

/home/strick/bin/x
     1        #!/usr/bin/tclsh
     2
     3        puts [expr [join $argv]]

//////////////////////////////////////

==> /usr/local/google/home/strick/bin/clock-format <==
case $1 in
  -u) GMT=true ; shift ;;
  *) GMT=false ;;
esac

case $2 in
  "") FMT="%Y-%m-%d %H.%M.%S" ;;
  *)  FMT="$2" ;;
esac

tclsh <<.

  puts [clock format "$1" -format "$FMT" -gmt "$GMT"]

.

==> /usr/local/google/home/strick/bin/clock-scan <==
case $1 in
  -u) GMT=true ; shift ;;
  *) GMT=false ;;
esac

tclsh <<.

  puts [clock scan "$*" -gmt "$GMT"]

.

==> /usr/local/google/home/strick/bin/clock-seconds <==
tclsh <<.

  puts [clock seconds]

.

/////////////////////////////////////////////

~/bin/datei
     1        date +%Y-%m-%d--%H-%M-%S


 ~/bin/enscript-courier-bold-10-qed
     1        #!/bin/sh
     2
     3        set -x
     4        exec enscript -b 'strick[$%]' -C -j -P qed-color -f Courier-Bold@10 --mark-wrapped-lines=box "$@"

~/bin/commas
     1        #!/usr/bin/tclsh
     2        #
     3        #  Cats text from stdin to stdout, inserting commas in numbers
     4
     5        proc commafy s {
     6          while {[regexp {(.*)([0-9]*[0-9])([0-9][0-9][0-9])(.*)} $s - 1 2 3 4]} {
     7            set s "$1$2,$3$4"
     8          }
     9          return $s
    10        }
    11
    12        while {[gets stdin line]>=0} {
    13          puts [commafy $line]
    14        }

~/bin/ci-l
     1        set -x
     2
     3
     4        ci -l -m/dev/null -t/dev/null -q $(find /dev/null "$@" -prune -type f -perm -0200)
(unless otherwise marked) Copyright 2002-2014 YakPeople. All rights reserved.
(last modified 2017-01-31)       [Login]
(No back references.)