Re: avoiding .scottyrc in scotty-2.1.x

Robert Premuz (rpremuz@srce.hr)
Sat, 5 Oct 1996 15:11:00 +0200 (MET DST)

On Wed, 2 Oct 1996, Juergen Schoenwaelder wrote:
>
> Do you have a suggestion how the Tnm extension should decide if it
> should source ~/.scottyrc or not? Checking tcl_interactive is not a
> solution because I like to have a mechanism to load user specific
> definitions that make sense for interactive and non-interactive
> scripts. Ideas welcome.

Well, the Tnm extension could check an environment variable (e.g.
SCOTTYRC). If it exists and is set to 0, then ~/.scottyrc is not
sourced, otherwise it is.

Now, to avoid the sourcing of ~/.scottyrc, a scotty application may
start as in the following example:

---------------------------- example.tcl ----------------------------
#!/bin/sh
# the next line restarts the script using scotty interpreter
# with preventing it from sourcing ~/.scottyrc \
export SCOTTYRC ; SCOTTYRC=0 ; exec scotty "$0" "$@"

# scotty application starts here

if {[info exists env(SCOTTYRC)] && $env(SCOTTYRC) == 0} {
puts "~/.scottyrc not sourced"
}
exit
---------------------------------------------------------------------

Any comments to this suggestion?

v
-- rpr. : Robert B. Premuz * Email: rpremuz@public.srce.hr
http://public.srce.hr/~rpremuz/ * Voice at home: +385 (0)1 687564