From: short <> Date: Fri, 28 Jun 2002 01:31:09 +0000 (+0000) Subject: .bashrc: +function exx: cd into $extdir if it is the only one created (successfuly) X-Git-Tag: bp_liverpm~126 X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=commitdiff_plain;h=2f472d340e661adb173b2bc2126dfb2561ce533c .bashrc: +function exx: cd into $extdir if it is the only one created (successfuly) - sideeffect: exx function does >&2 --- diff --git a/.bashrc b/.bashrc index df928dd..51d3b5a 100644 --- a/.bashrc +++ b/.bashrc @@ -113,6 +113,7 @@ function ctags {(unset ctags; find -type f -a '(' -name "*.[chC]" -o -name "*.cc" -o -name "*.java" ')'|ctags --file-tags -L - fi; );}; export -f ctags function cpan {(unset cpan; if [ $# = 0 ];then cpan;else perl -MCPAN -e "install qw($*);";fi; );}; export -f cpan +function exx { cd "`unset exx;exx "$@"|tee /proc/self/fd/2|tail -n1|sed -n 's/^extdir=//p'`"; };export -f exx ulimit -c 0 set +H diff --git a/bin/exx b/bin/exx index 12de60d..c81dafe 100755 --- a/bin/exx +++ b/bin/exx @@ -27,6 +27,7 @@ use constant FORMATS=>{ die "Syntax: $0 )>..." if !@ARGV; +my @extdirs; my $origdir=cwd; for my $fname (@ARGV) { my @parsed; @@ -65,8 +66,10 @@ for my $fname (@ARGV) { print "\t$extdir/:\n"; STDOUT->flush(); my $rc; $rc=system $cmd and die "$cmd (rc=".($rc>>8)."): $!"; + push @extdirs,$extdir; } continue { chdir $origdir; } +print "extdir=".$extdirs[0]."\n" if 1==@extdirs; exit 0;