-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdo_setup.bash
executable file
·1891 lines (1766 loc) · 86.1 KB
/
do_setup.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# do_setup.bash: Initialization file for use with bash
# *** OLD: DO NOT MODIFY: use tomohara-aliases.bash instead! ***
#
# NOTES:
# - Obsolete old code flagged with '## OLD': either older definition
# or no longer used).
# - Misc. old code flagged with '## MISC' (e.g., old but potentially useful).
# - This gets invoked from $BIN/tomohara-aliases.bash.
# - from bash manual:
# Special Parameters
# ...
# @ Expands to the positional parameters, starting from
# one. When the expansion occurs within double
# quotes, each parameter expands as a separate word.
# That is, `` $@'' is equivalent to ``$1'' ``$2'' ...
# When there are no positional parameters, ``$@'' and
# $@ expand to nothing (i.e., they are removed).
# - CygWin takes very long to process this script so certain sections
# are not evaluated if under arahomot; TODO: check for CygWin flag.
# - Variables in function definitions should be declared local to avoid subtle problems
# due to retained values.
# - Function definition syntax:
# [ function ] name () { command-list; }
# where () is optional if 'function' given
# - Alias definition syntax:
# alias [-p] [name[=value] ...]
# - from bash man page:
# When bash is invoked as an interactive login shell, it
# first reads and executes commands from the file /etc/pro-
# file, if that file exists. After reading that file, it
# looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
# in that order, and reads and executes commands from the
# first one that exists and is readable.
# ...
# When an interactive shell that is not a login shell is
# started, bash reads and executes commands from ~/.bashrc,
# if that file exists.
# ...
#
# TODO:
# - *** Merge this script into tomohara-aliases.bash (to minimize number of scripts for setup such as .bashrc, that one, and this one).
# - ** In meantime. finish conditioning little-used stuff on INCLUDE_MISC_ALIASES, as follows:
# if [ "$INCLUDE_MISC_ALIASES" = "1" ]; then ... fi
# - ** Similarly, comment out aliases no longer used.
# - ** Place old but potentially useful stuff in external script (e.g., Tex support).
# - Replace /tmp with $TEMP in old and miscelleneous aliases (see INCLUDE_MISC_ALIASES usages below).
# - convert $* to "$@" throughout, as appropriate
# - add more structure and decompose into helper scripts (e.g, wordnet aliases)
# - use dashes instead of underscores in scripts as well as macros
# - decompose into do-cs-setup.bash do-arahomot-setup.bash, etc.
# - add more optional sections (as with 'if [ "$HOST" != "arahomot" ]; ...'
# - replace '-' macro suffix (eg, 'gr-') with something more uniformative (eg, '-alt')
# - create function for recreating local directories (e.g., ~/info) assumed by do-setup scripts (e.g., do_setup.bash)
# - Remove () from function definitions.
# - Add error checking in functions for unspecified arguments.
# - Make sure all function variables use local.
# - Add upcase alias (perl -pe 's/(.*)/\U$1\e/g;')
# - Make sure functions don't refer to undefined macros (e.g., defined later).
# - Document environment variable assumptions (e.g., HOST, DEFAULT_HOST, etc.)!
#
# Uncomment the following line for tracing:
## set -o xtrace
## echo do_setup.bash
# Uncomment the following to display the environment variables
# TODO: use startup-trace for this
## alias printenv="set | egrep '^\w+='"
## alias printenv="set | egrep '[^ ]+='"
## printenv.sh
## OLD
## # Bash customizations (e.g., no beep)
## set bell-style none
## export HISTCONTROL=erasedups
## # via `man 3 strftime`:
## # %F Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)
## # %T The time in 24-hour notation (%H:%M:%S). (SU)
## export HISTTIMEFORMAT='[%F %T] '
# Directory for scripts
if [ "$BIN" = "" ]; then export BIN="$TOM_BIN"; fi
if [ "$BIN" = "" ]; then export BIN=~/bin; fi
# Helper functions:
# conditional-source(filename): source in bash commands from filename if exists
# check-arg(function-name, last-argument): issue warning if argument missing
# NOTE: use $FUNCNAME as first argument to check-arg (eg, 'check-arg $FUNCNAME $1';)
#
function conditional-source () { if [ -e "$1" ]; then source $1; else echo "Warning: bash script file not found (so not sourced):"; echo " $1"; fi; }
#
function check-arg () { if [ "$2" == "" ]; then echo "WARNING: missing argument to $1"; fi; }
# Alias for startup-script tracing via startup-trace function
if [ ! -e "$HOME/temp" ]; then
echo "WARNING: creating $HOME/temp for startup script logs"
mkdir "$HOME/temp"
fi
## OLD
## function startup-trace () { if [ "$STARTUP_TRACING" = "1" ]; then echo $* [$HOST `date`] >> $HOME/temp/.startup-$HOST-$$.log; fi; }
## conditional-source $BIN/startup-tracing.bash
#
## OLD
## alias trace='startup-trace'
## alias enable-startup-tracing='export STARTUP_TRACING=1'
## alias disable-startup-tracing='export STARTUP_TRACING=0'
## alias enable-console-tracing='export CONSOLE_TRACING=1'
## alias disable-console-tracing='export CONSOLE_TRACING=0'
#-------------------------------------------------------------------------------
trace 'in do_setup.bash'
# Fixup for Linux OSTYPE setting (likewise for solaris)
# TODO: use ${OSTYPE/[0-9]*/}
case "$OSTYPE" in linux-*) export OSTYPE=linux; esac
case "$OSTYPE" in solaris*)
export OSTYPE=solaris;
alias printenv='printenv.sh'
esac
## OLD:
## # Settings for less command
## # LESS="-cFIX-P--Less-- ?f%f:(stdin). ?e(END):?pb(%pb\%) ?m(%i of %m)..%t"
## #
## # less options:
## # -c full screen repaints to be painted from the top line down
## # -F automatically exit if the entire file can be displayed on first screen
## # -I searches ignore case even if the pattern contains uppercase letters
## # -S Causes lines longer than the screen width to be chopped
## # -X Disables sending the termcap initialization and deinitialization
## # -P changes the prompt
## # to override on command line
## # -+<option> ex: -+F
## #
## export LESS="-cFIX-P--Less-- ?f%f:(stdin). ?e(END):?pb(%pb\%) ?m(%i of %m)..%t"
## # Disables full-screen repaints under minimal-installation hosts (e.g., Beowolf nodes)
## if [ "$BAREBONES_HOST" = "1" ]; then export LESS="-cIX-P--Less-- ?f%f:(stdin). ?e(END):?pb(%pb\%) ?m(%i of %m)..%t"; fi
## ## export LESSCHARSET=latin1
## export PAGER=less
## NOTE: following needed for multilingual aliases
export PAGER_CHOPPED="less -S"
export PAGER_NOEXIT="less -+F"
## function zless () { zcat "$@" | $PAGER; }
## alias less-="$PAGER_NOEXIT"
alias less-pager="$PAGER_NOEXIT"
## alias less-tail="$PAGER_NOEXIT +G"
## export ZPAGER=zless
#-------------------------------------------------------------------------------
trace start of main settings
## OLD
## # Path settings
## # TODO: define a function for removing duplicates from the PATH while
## # preserving the order
## function show-path-dir () { (echo "${1}:"; printenv $1 | perl -pe "s/:/\n/g;") | $PAGER; }
## alias show-path='show-path-dir PATH'
## function append-path () { export PATH=${PATH}:$1; }
## function prepend-path () { export PATH=$1:${PATH}; }
## OLD:
## ## OLD: export ORIGINAL_PATH=$PATH
## # TODO: develop a function for doing this
## if [ "`printenv PATH | grep $BIN:`" = "" ]; then
## export PATH="$BIN:$PATH"
## fi
## if [ "`printenv PATH | grep $BIN/${OSTYPE}:`" = "" ]; then
## export PATH="$BIN/${OSTYPE}:$PATH"
## fi
## # TODO: make optional & put append-path later to account for later PERLLIB changes
## append-path $PERLLIB
## # Put current directoy at end of path; can be overwritting with ./ prefix
## export PATH="$PATH:."
## export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib:$LD_LIBRARY_PATH
## OLD
## # Bash settings
## #
## # FIGNORE: A colon-separated list of suffixes to ignore when performing filename completion ("tab completion")
## export FIGNORE=".o:.fasl:.fas:.lib"
## ## TEST: export FIGNORE=".o:.fasl:.fas:.lib:.log"
## ## TODO: figure out how to exlcude .log for executable-tab-expansion (e.g., first position)
## export FIGNORE=".o:.fasl:.fas:.lib"
## set -o noclobber
## # MAILCHECK: Specifies how often (in seconds) bash checks for mail.
## # ... If this variable is unset, the shell disables mail checking.
## unset MAILCHECK
##
## # MAIL If this parameter is set to a file name and the MAILPATH variable is not
## # set, bash informs the user of the arrival of mail in the specified file.
## unset MAIL
# Unix environ
# note:
# - TEMP is my private temp dir; TMP is system temp dir
# - these settings should be done in .bashrc, .cshrc, etc. so that trace could use TEMP
## OLD:
## export TEMP=$HOME/temp
## export TMP=/tmp
## export TMPDIR=$TEMP
## # The following are in support of ps_sort.perl
## export LINES
## export COLUMNS
# NOTE: resize used to set lines below
#
## OLD:
## if [ "$DOMAIN_NAME" = "" ]; then export DOMAIN_NAME=`domainname.sh`; fi
## OLD:
## # NMSU CS settings
## if [ "$DOMAIN_NAME" = "cs.nmsu.edu" ]; then
## export TOM=/home/ch1/tomohara
## export GRAPHLING_TOM=/home/ch2/graphling/USERS/TOM
## export OTHER_TOM=/home/ch3/graphling2/USER/TOM
## # PRINTER is set in do_setup.sh
## # TODO: figure out out to use a pattern; also use separate variable
## # based on OSTYPE (to avoid problems with other programs that rely on it)
## ## if [ "$OSTYPE" = "solaris2.6" ]; then export OSTYPE=solaris; fi
## ## if [ "$OSTYPE" = "solaris2.7" ]; then export OSTYPE=solaris; fi
## alias cs-hosts='echo `cat $HOME/cs/cs-hosts.list`'
## alias cs-load='cs-load.sh --all'
## ## alias p4-load='cs-load.sh --p4'
## alias p4-load='cs-load.sh `cat $HOME/cs/cs-summer-p4-linux-hosts.list`'
## alias p4-free='p4-load | grep " 0 users "'
## alias p4-busy='p4-load | grep "load average: [0-9].[1-9]"'
## alias wb-load='cs-load.sh --wb'
## ## alias bw-load='cs-load.sh --bw'
## alias bw-load='cs-load.sh --reverse --bw'
## alias bw-load-half1='cs-load.sh --bw1'
## alias bw-load-half2='cs-load.sh --bw2'
## ## alias bw-load='cs-load.sh --bw'
## ## alias dominica-load='rup.sh dominica'
## alias bangkok-load='rup.sh bangkok'
## alias mount-cd='mount /dev/cdrom'
## alias unmount-cd='umount /dev/cdrom'
## alias ml='/local/ml-110/bin/sml'
## ## alias set-home-display-export='export DISPLAY=128.123.63.127:0.0; echo "DISPLAY set to $DISPLAY"'
## ## if [ "$BEOWULF_NODE" = "1" ]; then
## ## alias emacs='xemacs'
## ## fi
## export DEFAULT_HOST=thoth
## if [ -e $HOME/.default_host ]; then export DEFAULT_HOST=`cat $HOME/.default_host`; fi
## fi
## alias run-csh='export USE_CSH=1; csh; export USE_CSH=0'
#-------------------------------------------------------------------------------
# Tex settings
trace Tex settings
## export TEXINPUTS=.:$HOME/latex:/local/teTeX-1.04/share/texmf/tex/latex/base
## TODO: add something like following; check all do_tex logs to see which dirs are used
# export TEXINPUTS=.:$HOME/latex:/usr/share/texmf/tex/latex/base:/usr/share/texmf/tex/latex/psnfss
export LATEX=/usr/share/texmf/tex/latex
## export TEXINPUTS=.:$HOME/latex:$LATEX/base:$LATEX/psnfss:$LATEX/graphics:$LATEX/cmbright
## TODO: export TEXINPUTS=.:$HOME/latex:$LATEX
#-------------------------------------------------------------------------------
## # GraphLing-related environment variables
## #
## trace host-specific settings
## if [ "$DOMAIN_NAME" = "cs.nmsu.edu" ]; then
## trace GraphLing-related environment variables
## # Commonly used directories
## if [ "$GRAPHLING_HOME" = "" ]; then export GRAPHLING_HOME=/home/graphling; fi
## export GL_HOME=$GRAPHLING_HOME
## export DATA=$GL_HOME/DATA
## export GL_TOOLS=$GL_HOME/TOOLS
## export SCRIPT_DIR=$GL_HOME/USERS/TOM/UTILITIES
## export GL_UTILITIES=$GL_HOME/USERS/TOM/UTILITIES
## export EXPERIMENTS=$GL_HOME/EXPERIMENTS
## export HUGIN_SERVER=$GL_TOOLS/HUGIN/PCSOL_HUGIN/SERVER
## export SOURCE=$GL_HOME/SOURCE
## export FEATURE_SOURCE=$SOURCE/FEATURE_TOOLS
## #
## # Those for some common experiment directories
## export FRAMENET_PREPOSITION=$EXPERIMENTS/FRAMENET-PREPOSITION
## export TREEBANK_PREPOSITION=$EXPERIMENTS/TREEBANK-PREPOSITION
## export SENSEVAL2=$EXPERIMENTS/SENSEVAL2
## export SENSEVAL3=$EXPERIMENTS/SENSEVAL3
## export SENSEVAL=$SENSEVAL3
## export BN_EXAMPLES=$EXPERIMENTS/EXAMPLE-BAYES-NETS
## ## export COOKING=$EXAMPLE_BAYES_NETS/COOKING
## export DSO_BAYES=$GL_HOME/EXPERIMENTS/DSO/BAYESIAN-NETWORKS
## ## export SENSEVAL2_BAYES=$GL_HOME/EXPERIMENTS/SENSEVAL2/BAYESIAN-NETWORKS
## ## export FACTOTUM=$EXPERIMENTS/FACTOTUM
## ## export LYRICS=$EXPERIMENTS/LYRICS
## export SOYBEAN=$GL_HOME/USERS/TOM/SOYBEAN
## export DIFFERENTIA=$EXPERIMENTS/DIFFERENTIA
## export SETENV_SCRIPTS=$EXPERIMENTS/SETENV_SCRIPTS
## export LEXICAL=$DATA/LEXICAL_RELATIONS
## export WSJ=$DATA/WSJ
## #
## # Cyc-related directories
## export SPEECH_PART=/home/ch1/tomohara/speech-part-inference
## export CYC_SPEECH_PART=/home/ch1/tomohara/speech-part-inference/cyc
##
## # Personal file settings
## #
## # Environment variables pointing to commonly used directories
## export TOM=/home/ch1/tomohara
## export CARTERA_DE_TOMAS=$TOM/cartera-de-tomas
## export TOMAS=$CARTERA_DE_TOMAS
##
## # Other commonly used directories
## export ELISP=/usr/share/emacs/21.2/lisp
##
## # Allegro Common Lisp
## export ACL=$GL_TOOLS/ACL
## alias acl='$ACL/bin/pb_cl'
## fi
## OLD:
## # ILIT-specific initializations
## export ILIT_HOST=0
## if [ "$HOST" = "arahomot" ]; then
## export THOTH=thoth.ilit.umbc.edu
## export YAVIN=yavin.ilit.umbc.edu
## export NABOO=naboo.ilit.umbc.edu
## export BACKUP_SERVER=$NABOO
## export ILIT_SERVER=$THOTH
## fi
##
## if [ "$HOST" = "thoth" ]; then
## echo "WARNING: unexpected host THOTH (should now be YAVIN)"
## export ILIT_HOST=1
## elif [ "$HOST" = "yavin" ]; then
## export ILIT_HOST=1
## append-path /home/shared/bin:/usr/java/j2sdk1.4.2_01/bin:/usr/local/ant/bin
## export SHARED=/home/shared
## export _CATALINA_HOME=/usr/tomcat4
## export CVSROOT=$SHARED/cvsroot
## export POSTGRES_HOME=/home/pgsql
## elif [ "$HOST" = "naboo" ]; then
## export ILIT_HOST=1
## export JAVA_HOME=/usr/java/jdk1.5.0_05
## ## append-path /home/shared/bin:/usr/java/jdk1.5.0_05/bin
## append-path /home/shared/bin
## prepend-path /usr/java/jdk1.5.0_05/bin
## prepend-path /naboo/data/shared/source/apache-ant-1.6.5/bin
## ## append-path /usr/site/ant-1.6.5/bin
## ## export SHARED=/naboo/data/shared
## export SHARED=/home/shared
## export _CATALINA_HOME=/usr/tomcat5
##
## # TODO: create mirror of thoth /home under naboo (w/ dummy dirs for users and other private directories)
## export CVSROOT=:ext:[email protected]:/home/shared/cvsroot
## export MAVEN_HOME=$SHARED/source/maven-1.0.2
## append-path $MAVEN_HOME/bin
## export POSTGRES_HOME=/var/lib/pgsql
## export THOTH_BACKUP=/usr/site/backups/thoth_home
##
## export ACL=/usr/local/acl/acl62
## alias acl='$ACL/alisp'
## fi
##
## if [ "$ILIT_HOST" = "1" ]; then
## ## export DOMAIN_NAME=ilit.umbc.edu
## export DOMAIN_NAME=umbc.edu
##
## export CVSROOT=$SHARED/cvsroot
## export PREP_SRC=$SHARED/Text-preprocessor-v4.0a/Projects/prep
## export PREP_DATA=$SHARED/data/prep
## export ARCHIVE=$SHARED/archive
## export BIN=$SHARED/bin
## export FULL_ANALYZER=$BIN/Full_Analyzer
## export REFERENCE=$ANALYZER/reference
## export WWW=/home/www
## export LOOKUP_SRC=$SHARED/Text-preprocessor-v4.0a/Projects/lookup
## export GRAPHLING_HOME=$SHARED/graphling
##
## export GRAPHLING_HOME=$SHARED/graphling
## export GL_HOME=$GRAPHLING_HOME
## export GL_DATA=$GL_HOME/DATA
## export GL_TOOLS=$GL_HOME/TOOLS
## export GL_EXPERIMENTS=$GL_HOME/EXPERIMENTS
## export GL_UTILITIES=$GL_HOME/UTILITIES
## append-path $GL_UTILITIES
## export LINK_GRAMMAR_HOME=$GL_TOOLS/LINK_GRAMMAR
##
## export BUGZILLA=$WWW/bugzilla
## export SOURCE=$SHARED/source
## export DEKADE=$SOURCE/tpo/dekade
## DEDAKE_SERVER_PORT=16777
## MY_DEDAKE_SERVER_PORT=16778
## export ANALYZER=$BIN/tpo-Full_Analyzer
## export SCRIPTS=$ANALYZER/scripts
## export TOMCAT_LOGS=$_CATALINA_HOME/logs
## export DEKADE_LOGS=/home/tmp/log-files
## export STORAGE_DIR=/home/tmp/tpo-dekade_storage
## export VP=$SOURCE/tpo/virtual-patient/VP-Tutor
## export VP_=$SOURCE/virtual-patient/VP-Tutor
##
## export SWING_TUTORIAL=$SHARED/source/swing-tutotial
## export SWING_TUTORIAL_COMPONENTS=$SWING_TUTORIAL/uiswing/components/example-swing
##
## export FRAMENET_PREPOSITION=$GL_EXPERIMENTS/TEST-FRAMENET
##
## alias openoffice='/naboo/data/openoffice/program/soffice'
##
## export EMACSDIR='/usr/share/emacs/21.3'
##
## export UMBC_WEB_HOST="gl.umbc.edu"
##
## # Remove special language settings (e.g., UTF)
## # TODO: set the encoding explicitly
## unset LANG
## fi
## #
## function host-upload () { local host=$1; shift; $scpcmd "$@" $host:temp; }
## function host-download-dir () {
## local host=$1; shift;
## local dir="$1"; shift;
## local files=`echo " $@ " | perl -pe "s@ (\\S+)@$host:temp/\\$1 @g;"`;
## $scpcmd $files $dir; echo "downloaded to $dir"; }
## #
## # TODO:
## if [ "$HOST" != "thoth" ]; then
## alias ilit-upload='host-upload $THOTH'
## alias ilit-download='host-download-dir $THOTH ~/xfer'
## alias ilit-download-here='host-download-dir $THOTH .'
## fi
## #
## if [ "$HOST" != "naboo" ]; then
## alias naboo-upload='host-upload $NABOO'
## alias naboo-download='host-download-dir $NABOO ~/xfer'
## alias naboo-download-here='host-download-dir $NABOO .'
## fi
## #
## ## OLD: alias ssh-tunnel-db='set_xterm_title.bash "ssh tunnel for Postgress access"; ssh -L 5432:localhost:5432 thoth.ilit.umbc.edu'
## OLD:
## # Convera stuff
## # TODO: see why domainname is 'converanis' and not 'convera.com'
## if [ "$DOMAIN_NAME" = "converanis" ]; then
## export GRAPHLING_HOME=/mdhome/tohara/graphling;
## export GL_DATA=$GRAPHLING_HOME/DATA
## export GL_TOOLS=$GRAPHLING_HOME/TOOLS
## export GL_EXPERIMENTS=$GRAPHLING_HOME/EXPERIMENTS
## export GL_UTILITIES=$GRAPHLING_HOME/UTILITIES
## ## append-path $GL_UTILITIES
## alias gv=/usr/bin/ggv
## alias xterm-utf8="xterm -u8 -fn '-b&h-lucidatypewriter-medium-r-normal-sans-0-0-75-75-m-0-iso10646-1'"
## #
## if [ "$INSTALL_DIR" = "" ]; then export INSTALL_DIR=$HOME/Convera/rware; fi
## rware_dir="$INSTALL_DIR"
## #
## alias start-jboss='(pushd $rware_dir/jboss-4.0.3/bin; run.sh >| run-jboss.log 2>&1; popd) &'
## alias stop-jboss='$rware_dir/jboss-4.0.3/bin/shutdown.sh'
## alias kill-jboss='kill_em.sh -p "java.*jboss"'
## alias view-jboss-log='less $rware_dir/jboss-4.0.3/server/rware/log/server.log'
## #
## alias rware-env-here='export INSTALL_DIR=$PWD; source set_rware_env.sh; do-setup'
## #
## rware_bin=$rware_dir/bin
## rware_lib=$rware_dir/lib
## alias start-admind='$rware_dir/admin/manage_admind start'
## alias stop-admind='$rware_dir/admin/manage_admind stop'
## alias restart-admind="stop-admind; start-admind"
## alias query-admind="ps_mine.sh | grep execd"
## alias kill-admind="kill_em.sh -p execd"
## #
## function kill-rware-forcibly() { foreach.perl 'kill_em.sh $f' execd cqdh cqindex cqns cqquery cqsched cqserv cqxref cqkey cqcred rwadmin DefaultCluster DefaultIndexCluster DefaultCluster_SearchService NameService_default CrossRef_default; ps_mine.sh; }
## #
## alias ssh-neon='ssh -X neon'
## #
## alias start-dcw="$rware_dir/bin/start_dcw"
## #
## prepend-path /SCM/3rd_party/ant/1.6.5/bin
## export ANT_HOME=/SCM/3rd_party/ant/1.6.5
## export CLASSPATH=$CLASSPATH:/SCM/3rd_party/junit/3.8.1/
## #
## # Miscellaneous directories
## NIGHTLY=/SCM/available/v82/nightly
##
## # X Windows related
## # TODO: alias=enable-remote-hosts="xterm -e '/usr/bin/bash -c /usr/X11R6/bin/xhost +'"
## alias set-tohara-display='export DISPLAY=10.0.34.33:0.0'
##
## # Remove special language settings (e.g., UTF)
## # TODO: set the encoding explicitly
## unset LANG
## fi
#-------------------------------------------------------------------------------
# Java related stuff
## OLD:
## trace Java settings
## alias ant-rebuild-war='(/bin/rm /tmp/$USER/*; ant dist; remove; install) >| ant-war-rebuild.log 2>&1; $PAGE +G ant-war-rebuild.log'
## alias ant-rebuild='(ant clean compile; ant remove; ant install-build) >| ant-rebuild.log 2>&1; $PAGER +G ant-rebuild.log'
#-------------------------------------------------------------------------------
# SSH key switching
trace SSH settings
alias ssh-putty-keys='/bin/cp -f $HOME/.ssh2/authorization.putty $HOME/.ssh2/authorization; /bin/cp -f $HOME/.ssh2/identification.putty $HOME/.ssh2/identification'
alias home-keys='ssh-putty-keys'
alias ssh-linux-keys='/bin/cp -f $HOME/.ssh2/authorization.linux $HOME/.ssh2/authorization; /bin/cp -f $HOME/.ssh2/identification.linux $HOME/.ssh2/identification'
## OLD: alias cs-keys='ssh-linux-keys'
# reset CDPATH to just current directory
export CDPATH=.
# Just use $ for Bash prompt
# NOTE: cd override puts directory name in xterm title
## OLD: export PS1="$ "
## TODO: define conditional-export (see tomohara-aliases.bash)
if [ "$PS1" = "" ]; then export PS1="$ "; fi
# flag for turning off GNOME, which can be flakey at times
export USE_GNOME=1
## OLD:
## # General Settings for my perl scripts
## ## OLD
## ## export DEBUG_LEVEL=2
## ## alias debug-on='export DEBUG_LEVEL=3'
## ## OLD: export ORIGINAL_PERLLIB=$PERLLIB
## if [ "$PERLLIB" = "" ]; then PERLLIB="."; else PERLLIB="$PERLLIB:."; fi
## ## export PERLLIB="$BIN:$PERLLIB:$HOME/perl/lib/perl5/site_perl/5.8.0:$HOME/perl/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/:$HOME/lib/perl5/5.00503/i386-linux:$BIN/MODULES"
## # NOTE: perl uses architecture-specific subdirectories under PERLLIB
## export PERLLIB="$BIN:$PERLLIB:$HOME/perl/lib/perl5/site_perl/5.8"
## # HACK: not all cygwin directories being recognized
## export PERLLIB="$PERLLIB:$HOME/perl/lib/perl5/site_perl/5.8/cygwin"
## alias perl-='perl -Ssw'
## ## if [ "$MANPATH" = "" ]; then MANPATH="."; else MANPATH="$MANPATH:."; fi
## export MANPATH="$HOME/perl/share/man/man1:$MANPATH"
## append-path $HOME/perl/bin
## OLD:
## # Set the title for the current xterm, unless if not running X
## function set-title-to-current-dir () {
## local dir=`basename "$PWD"`;
## local other_info="";
## if [ "$CLEARCASE_ROOT" != "" ]; then other_info="; $other_info cc=$CLEARCASE_ROOT"; fi
## set_xterm_title.bash "$dir [$PWD]$other_info";
## }
## ## if [ "$TERM" = "xterm" ]; then set-title-to-current-dir; fi
## if [[ ("$TERM" = "xterm") || ("$TERM" = "cygwin") ]]; then set-title-to-current-dir; fi
## #
## alias reset-xterm-title='set_xterm_title.bash "$HOSTNAME $PWD"'
## alias alt-xterm-title='set_xterm_title.bash "alt $PWD"'
# Set file creation permission mask to enable RWX for user & group and none for others
# NOTE:
# - X needed in case directories created (or program files)
# - usage: umask ugo -or- umask symbolic-mode
#
## OLD: umask ug+rwx
# NOTE: umask is getting set to 0002 with above
#
## TODO: umask ug=rwx,o=r
# Settings for wordnet
# TODO: put these below with the other WN settings
## export WNSEARCHDIR=$GL_TOOLS/WORDNET-1.6/dict
## export wn=$GL_TOOLS/WORDNET-1.6/bin/$OSTYPE/wn
## alias wn17-env='conditional-source $GL_TOOLS/OLD/WORDNET-1.7/wn17_setenv.bash; export wn=$GL_TOOLS/OLD/WORDNET-1.7/bin/$OSTYPE/wn'
alias wn15-env='conditional-source $GL_TOOLS/WORDNET-1.5/wn15_setenv.bash; export wn=$GL_TOOLS/WORDNET-1.5/bin/$OSTYPE/wn'
alias wn16-env='conditional-source $GL_TOOLS/WORDNET-1.6/wn16_setenv.bash; export wn=$GL_TOOLS/WORDNET-1.6/bin/$OSTYPE/wn'
alias wn171-env='conditional-source $GL_TOOLS/WORDNET-1.7.1/wn171_setenv.bash; export wn=$GL_TOOLS/WORDNET-1.7.1/bin/$OSTYPE/wn'
alias wn20-env='conditional-source $GL_TOOLS/WORDNET-2.0/wn20_setenv.bash; export wn=$GL_TOOLS/WORDNET-2.0/bin/$OSTYPE/wn'
## OLD: if [ "$WNSEARCHDIR" = "" ]; then wn20-env; fi
## if [ "$WNSEARCHDIR" = "" ]; then wn171-env; fi
#-------------------------------------------------------------------------------
# Shell aliases for overriding commands, etc
#
trace alias overrides
# Command overrides for cd, etc. that set the xterm title to the current directory
# TODO: use alias's instead so that the same name can be used as the command
# NOTES:
#
# - (from bash manual) There is no mechanism for using arguments in
# the replacement text, as in csh. If arguments are needed, a shell
# function should be used.
#
# This is conditioned upon not running under emacs, so that the escape
# sequence doesn't end up in the buffer.
#
if [ "$UNDER_EMACS" != "1" ]; then
function cd () { builtin cd "$@"; set-title-to-current-dir; }
function pushd () { builtin pushd "$@"; set-title-to-current-dir; }
function popd () { builtin popd; set-title-to-current-dir; }
fi
# pushd-q, popd-q: quiet versions of pushd and popd
#
function pushd-q () { builtin pushd "$@" >| /dev/null; }
function popd-q () { builtin popd "$@" >| /dev/null; }
#
## OLD
## # Command overrides for moving and copying files
## # NOTE: -p option of cp (i.e., --preserve "preserve file attributes if possible")
## # leads to problems when copying files owner by others (although group writable)
## # cp: preserving times for /usr/local/httpd/internal/cgi-bin/phone-list: Operation not permitted
## # - other options for cp, mv, and rm: -i interactive; and -v verbose.
## other_file_args="-v"
## if [ "$OSTYPE" = "solaris" ]; then other_file_args=""; fi
## ## OLD: alias cls='clear'
## alias mv='/bin/mv -i $other_file_args'
## alias move='mv'
## alias move-force='move -f'
## # TODO: make sure symbolic links are copied as-is (ie, not dereferenced)
## alias copy="cp -ip $other_file_args"
## alias copy-force="/bin/cp -fp $other_file_args"
## alias cp="/bin/cp -i $other_file_args"
## alias rm="/bin/rm -i $other_file_args"
## alias delete="/bin/rm -i $other_file_args"
## alias del="delete"
## alias delete-force="/bin/rm -f $other_file_args"
## alias remove-force='delete-force'
## alias remove-dir-force='/bin/rm -rfv'
## alias delete-dir-force='remove-dir-force'
## #
## ## function copy-readonly () { if [ "$3" != "" ]; then echo 'only two arguments please!'; else /bin/cp -ipf $1 $2; if [ -f $2 ]; then chmod -w $2; else chmod -w $2/`basename $1`; fi; fi; }
## alias copy-readonly='copy-readonly.sh'
## #
## NICE="nice -19"
## OLD:
## #------------------------------------------------------------------------
## # Directory commands (via ls):
## trace directory commands
##
##
## # ls options: # -a all files; -l long listing; -t by time; -k in KB; -h human readable; -G no group; -d no subdirectory listings
## #
## core_dir_options="-altkh"
## dir_options="${core_dir_options}G"
## if [ "$OSTYPE" = "solaris" ]; then dir_options="-alt"; fi
## if [ "$BAREBONES_HOST" = "1" ]; then dir_options="-altk"; fi
## function dir () { ls ${dir_options} "$@" 2>&1 | $PAGER; }
## alias ls-full='ls ${core_dir_options}'
## function dir-full () { ls-full "$@" 2>&1 | $PAGER; }
## ## OLD: alias dir-='dir-full'
## alias dir-='ls ${dir_options}'
## function dir-sans-backups () { ls ${dir_options} "$@" 2>&1 | grep -v '~[0-9]*~' | $PAGER; }
## #
## # Miscellaneous directory helpers
## # Shows read-only files (for user)
## # ex: -r-xr-xr-x 1 root 4.7K 2013-12-13 17:18 ngram_filter.py
## function dir-ro () { ls ${dir_options} "$@" 2>&1 | grep -v '^[^ld].w' | $PAGER; }
## # Shows writable files (for user)
## # ex: -rwxr-x--x 1 root 9.4K 2014-06-26 20:18 gensim_test.py
## function dir-rw () { ls ${dir_options} "$@" 2>&1 | grep '^[^ld].w' | $PAGER; }
## # Shows files not executable
## # ex -rw-r--r-- 1 root 3.9K 2014-06-09 01:54 /mnt/tohara/src/sandbox/tohara/randomize_lines.py
## function dir-non-executable () { ls ${dir_options} "$@" 2>&1 | grep -v '^[^ld]..x' | $PAGER; }
##
## function subdirs () { ls ${dir_options} "$@" 2>&1 | grep ^d | $PAGER; }
## ## OLD: alias subdirs-proper='find . -maxdepth 1 -type d | grep -v "^\.\$"'
## alias subdirs-proper='find . -maxdepth 1 -type d | grep -v "^\.\$" | perl -pe "s@^\./@@;" | column'
## # note: -f option overrides -t: Unix sorts alphabetically by default; via ls manpage:
## # -f do not sort, enable -aU, disable -ls --color
## ## OLD: function subdirs-alpha () { ls ${dir_options} -f "$@" 2>&1 | grep ^d | $PAGER; }
## # drwxr-xr-x 3 root root 4096 Jun 12 02:39 boot
## # 1 2 3 4 5 6 7 8 9
## ## TEST: function subdirs-alpha () { ls -al "$@" 2>&1 | grep ^d | cut -d' ' -f9- | $PAGER; }
## function subdirs-alpha () { ls -al "$@" 2>&1 | grep ^d | $PAGER; }
## function sublinks () { ls ${dir_options} "$@" 2>&1 | grep ^l | $PAGER; }
## ## OLD: function sublinks-alpha () { ls ${dir_options} -f "$@" 2>&1 | grep ^l | $PAGER; }
## ## TEST: function sublinks-alpha () { ls -al "$@" 2>&1 | grep ^l | cut -d' ' -f9- | $PAGER; }
## function sublinks-alpha () { ls -al "$@" 2>&1 | grep ^l | $PAGER; }
## #
## alias glob-links='find . -maxdepth 1 -type l | sed -e "s/.\///g"'
## alias glob-subdirs='find . -mindepth 1 -maxdepth 1 -type d | sed -e "s/.\///g"'
##
## #
## alias ls-R='ls -R >| ls-R.list; wc -l ls-R.list'
## #
## # TODO: create ls alias that shows file name with symbolic links (as with ls -l but without other information
## # ex: ls -l | perl -pe 's/^.* \d\d:\d\d //;'
# Grep commands
trace grep commands
#
# check for a modern version of grep. For example,
#
# $ grep -V
# grep (GNU grep) 2.4.2
#
# Copyright 1988, 1992-1999, 2000 Free Software Foundation, Inc.
# ...
#
# In contrast, here's an old verion (e.g., under medusa):
#
# $ grep -V
# GNU grep version 2.0
# usage: grep [-[[AB] ]<num>] [-[CEFGVchilnqsvwx]] [-[ef]] <expr> [<files...>]
#
skip_dirs=""
modern_grep=`grep -V 2>&1 | head -1 | perl -ne 's/^.*(\d+\.\d+)/$1/; print ($1 >= 2.4 ? 1 : 0);'`
if [ "$modern_grep" = 1 ]; then skip_dirs="-d skip"; fi
## OLD
## # Grep settings
## # TODO: use gr and gr_ throughout for consistency
## # TODO: use -P flag (i.e., --perl-regexp) w/ grep rather than egrep
## # NOTE: MY_GREP_OPTIONS used instead of GREP_OPTIONS since grep interprets latter
## export GREP=egrep
## export MY_GREP_OPTIONS="-n $skip_dirs"
## ## alias gr='$GREP $skip_dirs -i -n'
## ## alias gr-="'$GREP $skip_dirs -n '
## function gr () { $GREP $MY_GREP_OPTIONS -i "$@"; }
## function gr- () { $GREP $MY_GREP_OPTIONS "$@"; }
## ## TODO: selection sort option spec based on version of bash or sort
## ## SORT_COL2="+1"
## SORT_COL2="--key=2"
## ## OLD: function grep-unique () { $GREP -c $MY_GREP_OPTIONS "$@" | grep -v ":0" | sort -rn +1 -t':'; }
## ## function grep-unique () { $GREP -c $MY_GREP_OPTIONS "$@" | grep -v ":0" | sort -rn --key=2 -t':'; }
## function grep-unique () { $GREP -c $MY_GREP_OPTIONS "$@" | grep -v ":0" | sort -rn $SORT_COL2 -t':'; }
## function grep-missing () { $GREP -c $MY_GREP_OPTIONS "$@" | grep ":0"; }
## alias gu='grep-unique -i'
## alias gu-='grep-unique'
## function gu-all () { grep-unique "$@" * | $PAGER; }
## alias gn='grep-missing'
##
## function gu- () { $GREP -c $MY_GREP_OPTIONS "$@" | grep -v ":0"; }
## function grepl () { $GREP -i $MY_GREP_OPTIONS "$@" | $PAGER -p$1; }
## function grepl- () { $GREP $MY_GREP_OPTIONS "$@" | $PAGER -p$1; }
##
## # gr-c: grep through c/c++ source and headers files
## # note: --no-messages suppresses warnings about missing files
## function gr-c () { gr --no-messages "$@" *.c *.cpp *.cxx *.h; }
## function gr-tex () { gr "$@" *.tex *.sty; }
## function gr-tex- () { gr- "$@" *.tex *.sty; }
## function gr-lisp () { gr "$@" *.lisp *.cl; }
## function gr-lisp- () { gr- "$@" *.lisp *.cl; }
## function old-trace-lisp () { echo "(trace" `perlgrep -show_filename=0 -para -v '\#\|[^\000]+defun[^\000]+\|\#' "$@" | extract_matches.perl "^\s*\(defun (\S+)" -` ")"; }
## function trace-lisp () { echo -n "(trace "; perlgrep.perl -show_filename=0 -para -v '\#\|[^\000]+defun[^\000]+\|\#' "$@" | extract_matches.perl "^\s*\(defun (\S+)" - | perl -pe "s/\n/ /;"; echo " )"; }
# TODO: create function for creating gr-xyz aliases
# TODO: -or- create gr-xyz template
## function gr-xyz () { gr- "$@" *.xyz; }
## OLD:
## #
## # show-line-context(file, line-num): show 5 lines before LINE-NUM in FILE
## function show-line-context() { cat -n $1 | egrep -B5 "^\W+$2\W"; }
##
## # Helper function for grep-based aliases pipe into less
## function gr-less () { gr "$@" | $PAGER; }
## OLD:
## # Commonly used grepping situations
## function gr-python () { gr "$@" ~/python/*.py; }
## OLD:
## # Other grep-related stuff
## #
## alias grep-nonascii='perlgrep.perl "[\x80-\xFF]"'
## alias gr-nonascii='perlgrep.perl -n "[\x80-\xFF]"'
## Old ILIT stuff (TODO remove this and other old stuff no longer used)
## # Aliases for ILIT OntoSem lisp sources files, lexicon and ontology
## lisp_source_files="lisp-source-files.list"
## function gr-ontosem () { dir=$1; shift; gr "$@" `cat $dir/$lisp_source_files | perl -pe "s@^@$dir/@;"` | $PAGER; }
## alias gr-onto-full='gr-ontosem $ANALYZER'
## function gr-onto () { gr-ontosem "$ANALYZER" "$@" | perl -pe "s@^$ANALYZER/*@@;" | $PAGER; }
## function gr-lexicon () { gr-less "$@" $ANALYZER/Inputs/combo-lex.lisp; }
## alias gr-lex='gr-lexicon'
## function gr-ontology () { gr-less "$@" $ANALYZER/Knowledge/Ontology/mikro-ontology.lisp; }
## alias clisp='clisp.sh'
## alias load-install='clisp -- -norc -i install.lisp'
## alias load-tpo-install='clisp -- -norc -i tpo-install.lisp'
## alias load-tpo-medical-install='clisp -- -norc -i tpo-medical-install.lisp'
## alias load-medical-install='clisp -- -norc -i medical-install.lisp'
## alias compile-ontosem='load-install'
## alias delete-fasl='find . \( -name "*.lib" -o -name "*.fas" -o -name "*.fasl" \) -exec rm -fv {} \;'
## alias delete-fasl-plus='/bin/rm -fv lispinit.mem; delete-fasl'
## alias reload-medical-install='delete-fasl; load-medical-install'
##
## # Likewise for VP source
## ## function gr-vp () { gr-less "$@" $VP/src/edu/umbc/ilit/*/*.java; }
## function gr-vp () { dir=$VP/src/edu/umbc/ilit; gr "$@" $dir/*/*.java | perl -pe "s@^$dir/@@;" | $PAGER; }
## function gr-vp-tests () { dir=$VP/test/edu/umbc/ilit; gr "$@" $dir/*/*.java | perl -pe "s@^$dir/@@;" | $PAGER; }
##
## alias kill-animator='kill_em.sh -p animator4.Main'
## function recreate-ontosem-image () { pushd $ANALYZER; clisp.sh --image lispinit.mem -- -x '(progn (load "tpo-init.lisp") (create-lisp-image))'; popd; }
## function gr-c () { gr "$@" *.c *.cpp; }
## function gr-c- () { gr- "$@" *.c *.cpp; }
## function gr-h () { gr "$@" *.h; }
## function gr-h- () { gr- "$@" *.h; }
function gr-bib () { perlgrep.perl -i -para "$@" *.bib; }
function gr-biblio () { perlgrep.perl -i -para "$@" *bib*.ascii; }
## OLD
## # Searching for files
## # TODO:
## # - specify find options in an environment variable
## # - rework in terms of Perl regex? (or use -iregex in place of -iname)
## #
## ## function findspec () { find $1 -iname \*$2\* $3 $4 $5 $6 $7 $8 $9 -print 2>&1 | grep -v '^find: '; }
## ## function findspec () { find $1 -iname \*$2\* $3 $4 $5 $6 $7 $8 $9 2>&1 | grep -v '^find: '; }
## function findspec () { if [ "$2" = "" ]; then echo "Usage: findspec dir glob-pattern find-option ... "; else find $1 -iname \*$2\* $3 $4 $5 $6 $7 $8 $9 2>&1 | grep -v '^find: '; fi; }
## function findspec-all () { find $1 -follow -iname \*$2\* $3 $4 $5 $6 $7 $8 $9 -print 2>&1 | grep -v '^find: '; }
## function fs () { findspec . "$@" | egrep -iv '(/(backup|build)/)'; }
## function fs-ls () { fs "$@" -exec ls -l {} \; ; }
## alias fs-='findspec-all .'
## function fs-ext () { find . -iname \*.$1 | egrep -iv '(/(backup|build)/)'; }
## # TODO: extend fs-ext to allow for basename pattern (e.g., fs-ext java ImportXML)
## function fs-ls- () { fs- "$@" -exec ls -l {} \; ; }
## alias fs-java='fs-ext java'
## #
## findgrep_opts="-in"
## #
## # NOTE: findgrep macros use $findgrep_opts dynamically (eg, user can change $findgrep_opts)
## ## OLD: function findgrep-verbose () { find $1 -follow -iname \*$2\* -print -exec egrep $findgrep_opts "$3" $4 $5 $6 $7 $8 $9 \{\} \;; }
## function findgrep-verbose () { find $1 -iname \*$2\* -print -exec egrep $findgrep_opts "$3" $4 $5 $6 $7 $8 $9 \{\} \;; }
## ## OLD: function findgrep () { find $1 -follow -iname \*$2\* -exec egrep $findgrep_opts "$3" $4 $5 $6 $7 $8 $9 \{\} /dev/null \;; }
## # findgrep(dir, filename_pattern, line_pattern): grep through files in DIR matching FILENAME_PATTERN for LINE_PATTERN
## function findgrep () { find $1 -iname \*$2\* -exec egrep $findgrep_opts "$3" $4 $5 $6 $7 $8 $9 \{\} /dev/null \;; }
## function findgrep- () { find $1 -iname $2 -print -exec egrep $findgrep_opts $3 $4 $5 $6 $7 $8 $9 \{\} \;; }
## ## function findgrep-ext () { find "$1" -iname "*.$2" -exec egrep $findgrep_opts "$3" "$4" "$5" "$6" "$7" "$8" "$9" \{\} /dev/null \;; }
## function findgrep-ext () { local dir="$1"; local ext="$2"; shift; shift; find "$dir" -iname "*.$ext" -exec egrep $findgrep_opts "$@" \{\} /dev/null \;; }
## # NOTE: findgrep-foreach removed since unused
## # TODO: put other little used aliases in new do-full-setup.bash file
## ## OLD: function findgrep-foreach () { find $1 -follow -iname \*$2\* -exec egrep $findgrep_opts -l $3 \{\} \; | foreach.perl "$4" -; }
## ## OLD: function findgrep-foreach- () { find $1 -follow -iname \*$2\* -exec egrep $findgrep_opts -l $3 \{\} \; | foreach.perl $4 $5 $6 $7 $8 $9; }
## ##
## # fgr(filename_pattern, line_pattern): grep through files matching FILENAME_PATTERN for LINE_PATTERN
## function fgr () { findgrep . "$@" | egrep -v '((/backup)|(/build))'; }
## function fgr-ext () { findgrep-ext . "$@" | egrep -v '(/(backup)|(build)/)'; }
## function fgr-java () { findgrep-ext . "java" "$@" | egrep -v '(/(backup)|(build)/)'; }
## #
## ## OLD: alias prepare-find-files-here='ls -alR >| ls-alR.list 2>&1'
## ## OLD: alias prepare-find-files-here="dobackup ls-alR.list fi; $NICE ls -alR >| ls-alR.list 2>&1"
## function prepare-find-files-here () { if [ -e "ls-alR.list" ]; then dobackup.sh ls-alR.list; fi; $NICE ls -alR >| ls-alR.list 2>&1; }
## ## OLD: function find-files-there () { perlgrep.perl -para "$1" "$2" | egrep -i '((^\.)|('$1'))' | $PAGER_NOEXIT -p "$1"; }
## function find-files-there () { perlgrep.perl -para -i "$@" | egrep -i '((^\.)|('$1'))' | $PAGER_NOEXIT -p "$1"; }
## function find-files-here () { find-files-there "$1" "$PWD/ls-alR.list"; }
## #
## # TODO: add --quiet option to dobackup.sh (and port to bash)
## # TODO: function conditional-backup() { if [ -e "$1" ]; then dobackup.sh $1; fi; }
alias make-file-listing='listing="ls-aR.list"; dobackup.sh "$listing"; ls -aR >| "$listing" 2>&1'
# Emacs commands
#
## OLD:
## alias emacs-='emacs'
## if [ "$DISPLAY" = "" ]; then
## alias emacs-='emacs --no-windows'
## function em () { if [ "$1" = "" ]; then emacs- .; else emacs- "$@"; fi; }
## else
## function em () { if [ "$1" = "" ]; then emacs- .; else emacs- "$@"; fi & }
## fi
## alias ed='em'
## OLD:
## alias em=tpo-invoke-emacs.sh
## function em-fn () { em -fn "$1" $2 $3 $4 $5 $6 $7 $8 $9; }
## alias em-tags=etags
## #
## alias em-misc='em-fn -misc-fixed-medium-r-normal--14-110-100-100-c-70-iso8859-1'
## alias em-nw='emacs --no-windows'
## alias em_nw='em-nw'
## function em-file () { set_xterm_title.bash "`basename $1` [`full-dirname $1`]"; em-nw "$@"; }
## ## OLD: alias em-dir='em .'
## ## OLD: function em-dir() { pushd "$1"; em .; popd; }
## alias em-this-dir='em .'
## alias em-devel='em --devel'
#
## OLD
## function em-debug () { em -debug-init "$@"; }
## function em-quick () { em -q "$@"; }
## function em-small () { em -fn "-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1" "$@"; }
## function em-large () { em -fn "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1" -geometry 70x30 "$@"; }
## function em-very-large () { em -fn "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1" -geometry 60x20 "$@"; }
## OLD:
## # Simple TODO-list maintenance commands
## #
## # add-todo(text): adds text<TAB><timestamp> to to-do list
## # todo: print example of using add-todo (for cut-n-paste purposes)
## # TODO: figure out way to have example copied into bash input buffer
## #
## # NOTE: tac is GNU reverse program ('reverse' of cat)
## # TODO: document all bash aliases (and functions) for benefit of others (and yourself!)
## ## OLD: alias view-todo="perl -SSw reverse.perl $HOME/info/todo_list.text | $PAGER_CHOPPED"
## # TODO: revert to using tac; why was reverse.perl used instead???
## alias view-todo="perl -SSw reverse.perl $HOME/organizer/todo_list.text | $PAGER_CHOPPED"
## #
## ## OLD: function add-todo () { echo "$@" \ `date` >> $HOME/info/todo_list.text ; view-todo; }
## function add-todo () { echo "$@" \ `date` >> $HOME/organizer/todo_list.text ; view-todo; }
## #
## function todo-one-week () { add-todo "[within 1 week] " "$@"; }
## #
## ## function todo () { echo add-todo '"[within N weeks] ..."'; }
## function todo () { if [ "$1" == "" ]; then echo add-todo '"[within N weeks] ..."'; else todo-one-week "$@"; fi; }
## #
## # todo:(text): convenience alias for todo() for cut-n-paste of 'TODO: ...' notes from files
## alias todo:='todo'
## # TODO: enable bash case insensitivity for support of TODO and TODO: as well
## # (eg, via "shopt -s nocaseglob" and "set completion-ignore-case on" in .bash_profile??
## alias TODO='todo'
## alias TODO:='todo'
## function TODO1() { todo "$@"'!'; }
## alias todo1=TODO1
## #
## function todo! () { if [ "$1" == "" ]; then todo; else todo "$@"'!'; fi; }
## #
## # mail-todo: version of todo that also ends email
## # TODO: use lynx to submit send-to type URL
## function mail-todo () { add-todo "$*"; echo TODO: "$*" | mail -s "TODO: $*" ${USER}@${DOMAIN_NAME}; }
## #
## # Likewise for time tracking
## ## OLD: alias view-track-time="tac $HOME/info/time_tracking_list.text | $PAGER_CHOPPED"
## alias view-track-time="tac $HOME/organizer/time_tracking_list.text | $PAGER_CHOPPED"
## alias view-time-tracking=view-track-time
## #
## ## OLD: function add-track-time () { echo "$@" \ `date` >> $HOME/info/time_tracking_list.text ; view-track-time; }
## function add-track-time () { echo "$@" \ `date` >> $HOME/organizer/time_tracking_list.text ; view-track-time; }
## #
## function track-time () { if [ "$1" == "" ]; then echo add-track-time '"..."'; else add-track-time "$@"; fi; }
## OLD:
# TODO: put signature in tomohara-aliases.bash
# TODO: use ~/organizer instead of ~/info???
## OLD: alias address-info='cat $HOME/info/address.text'
## OLD: alias combined-signature='cat $HOME/info/.combined-signature'
## OLD: alias full-signature='combined-signature'
## OLD: alias cs-signature='cat $HOME/info/.cs-signature'
## OLD: alias cell-signature='cat $HOME/info/.cell-signature'
## OLD: alias alt-cell-signature='cat $HOME/info/.alt-cell-signature'
## OLD: alias home-signature='cat $HOME/info/.home-signature'
## OLD: alias ilit-signature='cat $HOME/info/.ilit-signature'
## OLD: alias alt-cell-signature='cat $HOME/info/.alt-cell-signature'
## OLD: alias tomas-signature='cat $HOME/info/.tomas-signature'
## OLD: alias tpo-signature='cat $HOME/info/.tpo-signature'
## OLD: alias txstate-signature='cat $HOME/info/.txstate-signature'
## OLD: function signature () { cat $HOME/info/.$1-signature; }
## OLD:
## function signature () {
## if [ "$1" = "" ]; then
## ls $HOME/info/.$1-signature
## echo "Usage: signature dotfile-prefix"
## echo "ex: signature scrappycito"
## return;
## fi
## cat $HOME/info/.$1-signature
## }
## alias cell-signature='signature cell'
## alias home-signature='signature home'
## alias po-signature='signature po'
## alias tpo-signature='signature tpo'
## alias tpo-scrappycito-signature='signature tpo-scrappycito'
##
## OLD: alias pr-signature='signature pr'
#
# create aliases using underscores instead of dashes
# TODO: automatically do this for all aliases and scripts!
# TODO: see if bash has some translation option that would handle this transparently
#
## OLD:
## # TODO: create separate env-var for info directory (eg, $INFO)
## function gr-tidbits () { gr "$@" $HOME/info/tidbits.text; }
# Mail commands
trace mail commands
#
alias view-mail='$PAGER $HOME/mail/In'
function view-mail- () { $ZPAGER $HOME/mail/OLD/mail_$1.gz; }
alias view-mail-log='$PAGER $HOME/mail/sent-mail'
function view-mail-log- () { $ZPAGER $HOME/mail/OLD/logged_messages_$1.gz; }
alias view-mail-aliases='$PAGER $HOME/.mailrc'
## OLD:
## function mail-tpo () { mail -s $1 [email protected] < $1; }
## function mail-tpo () { mail -s $1 [email protected] < $1; }
## OLD:
## # Simple calculator commands
## function old-calc () { echo "$@" | bc -l; }
## ## function perl-calc () { echo "$@" | perl- perlcalc.perl -; }
## function perl-calc () { perl- perlcalc.perl -args "$@"; }
## # TODO: read up on variable expansion in function environments
## function perl-calc-init () { initexpr=$1; shift; echo "$@" | perl- perlcalc.perl -init="$initexpr" -; }
## alias calc='perl-calc'
## alias calc-init='perl-calc-init'
## alias calc-int='perl-calc -integer'
## function old-perl-calc () { perl -e "print $*;"; }
## function hex2dec { perl -e "printf '%d', 0x$1;" -e 'print "\n";'; }
## ## OLD: function oct2dec { perl -e "printf '%d', 0$1;" -e 'print "\n";'; }
## ## OLD: function oct2hex { perl -e "printf '%x', oct(q/$1/);" -e 'print "\n";'; }
## function dec2hex { perl -e "printf '%x', $1;" -e 'print "\n";'; }
## ## OLD: function dec2oct { perl -e "printf '%o', $1;" -e 'print "\n";'; }
## function bin2dec { perl -e "printf '%d', 0b$1;" -e 'print "\n";'; }
## function dec2bin { perl -e "printf '%b', $1;" -e 'print "\n";'; }
## alias hv='hexview.perl'
##
## # Miscellaneous commands
## trace Miscellaneous commands
## #
## alias startx-='startx >| startx.log 2>&1'