File: sh-to-mod.csh

package info (click to toggle)
modules 5.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,036 kB
  • sloc: exp: 79,659; sh: 6,142; tcl: 5,900; makefile: 1,493; ansic: 474; python: 265; csh: 202; perl: 47; ruby: 44; lisp: 13
file content (109 lines) | stat: -rw-r--r-- 3,321 bytes parent folder | download | duplicates (2)
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
# example shell script to test 'sh-to-mod' sub-command

if ( $?TESTSUITE_SHTOMOD_SHELLVAR ) then
   setenv FOOSHELL $shell
endif

if ( ! $?TESTSUITE_SHTOMOD_NOVAR ) then
   setenv FOO value
   setenv FOOEM ""
   setenv FOOSP "value "
   setenv FOOCB va\{ue
   setenv FOOWC va\*ue
   set i=1
   while ( $#argv > 0 )
      setenv FOOARG$i "$1"
      shift
      @ i++
   end
endif

if ( ! $?TESTSUITE_SHTOMOD_NOPATH ) then
   setenv FOOPATH /path/to/dir1:/path/to/dir2:/path/to/dir3
   setenv FOOPATHEM :/path/to/dir1:/path/to/dir2:/path/to/dir3
   setenv FOOPATHSP "/path/to/dir1 /path/to/dir2 /path/to/dir3"
   setenv FOOPATHSPEM "/path/to/dir1 /path/to/dir2 /path/to/dir3 "
   setenv FOOPATHCB /path/to/dir1:/path/to/d\{r2:/path/to/dir3
   setenv FOOPATHWC /path/to/dir1:/path/to/d\*r2:/path/to/dir3
endif

if ( $?TESTSUITE_SHTOMOD_PATHDUP ) then
   setenv FOOPATHDUP "/path/to/dir1:/path/to/dir1:/path/to/dir2:/path/to/dir1:/path/to/dir3:/path/to dir4:/path/to/dir3"
   setenv FOOPATHDUPEM :/path/to/dir1:/path/to/dir1:/path/to/dir2:/path/to/dir1:/path/to/dir3::/path/to/dir3
   setenv FOOPATHDUPSP "/path/to/dir1 /path/to/dir1 /path/to/dir2 /path/to/dir1 /path/to/dir3 /path/to:dir4 /path/to/dir3"
   setenv FOOPATHDUPSPEM "/path/to/dir1 /path/to/dir1 /path/to/dir2 /path/to/dir1 /path/to/dir3 /path/to/dir3 "
   setenv FOOPATHDUPMIX ":/path/to/dir1:/path/to/dir1 /path/to/dir2 /path/to/dir1:/path/to/dir3:/path/to/dir3:"
endif

if ( $?TESTSUITE_SHTOMOD_FUZZYOUT1 ) then
   echo '%ModulesShToMod%'
endif
if ( $?TESTSUITE_SHTOMOD_FUZZYOUT2 ) then
   # exit to provoke fuzz
   exec true
endif

if ( ! $?TESTSUITE_SHTOMOD_NOALIAS ) then
   alias alfoo 'echo `grep "report .Modules " ../../modulecmd.tcl | tr -d \\ | awk '"'"'{print \$3}'"'"'`'
   alias alcb 'echo f\{o'
   alias alem ''
   alias alsp 'echo f\"o; echo b\\\"r; echo f'"\'"'o'
endif

if ( ! $?TESTSUITE_SHTOMOD_NOFUNC ) then
   # no function support on csh shell
endif

if ( ! $?TESTSUITE_SHTOMOD_NOCOMP ) then
   complete cmd 'n/-h/n/' 'n/--help/n/' \
      'n/-V/n/' 'n/--version/n/' \
      "p/1/(-h -V --help --version)/"
   complete mycmd 'n/help/`_module_avail`/' 'n/add/`_module_not_yet_loaded; echo "--auto --no-auto --force -f --icase -i --tag --tag="`/'
   complete othercmd 'n/--help/n/'
endif

if ( ! $?TESTSUITE_SHTOMOD_NOCD ) then
   cd $TESTSUITEDIR/modulefiles.2
endif

if ( $?TESTSUITE_SHTOMOD_OUTMSG ) then
   echo "output message"
endif

if ( $?TESTSUITE_SHTOMOD_ERRMSG ) then
   echo "error message" > /dev/stderr
endif

if ( $?TESTSUITE_SHTOMOD_EXIT1 ) then
   # provoke an immediate exit with error code
   exec false
endif

if ( $?TESTSUITE_SHTOMOD_UNSETENV ) then
   unsetenv TESTSUITE_SHTOMOD_UNSETENV
endif

if ( $?TESTSUITE_SHTOMOD_EMPTYAPPEND ) then
   setenv TESTSUITE_SHTOMOD_EMPTYAPPEND ${TESTSUITE_SHTOMOD_EMPTYAPPEND}:
endif

if ( $?TESTSUITE_SHTOMOD_EMPTYPREPEND ) then
   setenv TESTSUITE_SHTOMOD_EMPTYPREPEND :$TESTSUITE_SHTOMOD_EMPTYPREPEND
endif

if ( $?TESTSUITE_SHTOMOD_MODULE ) then
   eval `$TCLSH $MODULES_CMD csh autoinit`
   module config collection_target bar
   module load setenv/1.0
   unalias ml
   unalias module
   unalias mogui
   unsetenv MODULESHOME
endif

if ( $?TESTSUITE_SHTOMOD_UNSETALFUNCCOMP ) then
   unalias alfoo
   uncomplete cmd
endif

# vim:set tabstop=3 shiftwidth=3 expandtab autoindent: