goj@abulafia ~ $ tail ~/.bashrc
function apply() {
cmd=$1
shift
for x in $*; do $cmd $x; done
}
function go() {
$@
cd ${!#}
}
Much better now. :)
goj@abulafia ~ $ tail ~/.bashrc
function apply() {
cmd=$1
shift
for x in $*; do $cmd $x; done
}
function go() {
$@
cd ${!#}
}
My Motto: "Why program by hand in five days what you can spend five years of your life automating?"
hg init my_repo; cd my_repo
mkdir -p a/b/c/d; cd a/b/c/d
mv my_file /tmp; cd /tmp
mkdir -p a/b/c/d; cd !$
go hg init my_repo
go mkdir -p a/b/c/d
go mv my_file /tmp
$1
is the first argument, $2
- second and $#
- argument count and $@
all arguments as an array... yes, you guessed it. It's ${!#}
$$# ${$#} ${${#}} $@[$#]
.goj@abulafia tmp $ cat go
#!/bin/bash
$@
cd ${!#}
goj@abulafia tmp $ ./go echo ~
/home/goj
goj@abulafia tmp $
goj@abulafia tmp $ . ./go echo ~
/home/goj
goj@abulafia ~ $
goj@abulafia tmp $ echo 'alias go=". go-source-me"' >> ~/.bashrc
goj@abulafia tmp $ mv go ~/bin/go-source-me
goj@abulafia tmp $ go echo ~
/home/goj
goj@abulafia ~ $
ExtFilterDefine ortozawal mode=output intype=text/html cmd="/usr/local/bin/ortozawal"
ExtFilterDefine ungzip-filter mode=output intype=text/html cmd="/bin/gunzip -"
ExtFilterDefine gzipme-filter mode=output intype=text/html cmd="/bin/gzip"
ExtFilterDefine flip-image mode=output cmd="/usr/bin/convert - -flip -"
<Location "/forum">
SetOutputFilter ungzip-filter;ortozawal;gzipme-filter
</Location>
<Location "/forum/images">
SetOutputFilter flip-image
</Location>