I located an example from one of my modules.
set PROMPT {\u@\h \W>}
switch [ lindex [ array get env TERM ] 1 ] {
xterm {
setenv TITLEBAR "${beginXTesc}pts/\\l \\u@\\h:\\w${endXTesc}"
setenv PS1 "[lindex [ array get env TITLEBAR] 1 ]$PROMPT"
}
linux {
setenv PS1 "$PROMPT"
}
default {
setenv PS1 "$PROMPT"
}
}
Kirk
On Fri, Jan 06, 2006 at 02:52:29PM -0800, Ted Stern wrote:
> This seems very basic but I'm a Tcl newbie and can't see how to do it.
>
> I have created a script named 'config_type' to output a unique string
> depending on the type of system I'm on, something like the GNU
> 'config.guess' script, but a little more precise. Some of the strings
> I'm dealing with:
>
> x86_64_xeon-intel-linux-redhat-RHELWS_3.5
> x86_64_xeon-intel-linux-redhat-RHELWS_4
> i686_xeon-intel-linux-redhat-RHL_7.3
> x86_64_opteron-amd-linux-suse-SLES_9.2
> x86_64_opteron-amd-linux-suse-SuSE_9.1
>
> I'd like to do two things in my modulefiles:
>
> 1) I want to set a variable to the output of config_type, as I would
> in a shell using (Bourne-shell syntax):
>
> config_type=`config_type`
>
> 2) I want to switch to various blocks using portions of the
> config_type string, analogous to
>
> case "$config_type" in
> *RHELWS*)
> # do red hat enterprise stuff
> ;;
> *RHL*)
> # do red hat stuff
> ;;
> *SLES*)
> # do SuSE Linux Enterprise Server stuff
> ;;
> *SuSE*)
> # do SuSE Linux stuff
> ;;
> esac
>
> Does anybody have some modulefile syntax examples of this kind of
> thing? Thanks!
>
> --
> dodecatheon at gmail dot com
> Frango ut patefaciam -- I break so that I may reveal
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
--
Kirk Patton
Unix Administrator
Transmeta Inc.
Tel. 408 919-3055
|