Sample Startup Scripts

Table of Contents

  1. Introduction
  2. Script ~/my.tcl
  3. Script ~/my_tkcon.tcl

Introduction

These startup scripts tailor Tcl and tkcon to personal requirements. The scripts can be copied to your home directory and modified as desired.

Script ~/my.tcl

The script ~/my.tcl is called by the script ~/.tclshrc or ~/tclshrc.tcl that is created by the standard nap installation. This ~/my.tcl script can be used to tailor Tcl in various ways such as

The following sample script defines some simple aliases.

# my.tcl --
#
proc define_alias {alias args} {proc $alias args "eval $args \$args"}
#
define_alias e expr
define_alias n nap
define_alias p pwd
define_alias cp file copy
define_alias md file mkdir
define_alias rm file delete

Script ~/my_tkcon.tcl

The script ~/my_tkcon.tcl is called by the script ~/.tkconrc or ~/tkcon.cfg that is created by the standard nap installation. This ~/my_tkcon.tcl script can be used to tailor various aspects of tkcon.

The following sample script defines

# my_tkcon.cfg --
#
set ::tkcon::OPT(font) "Courier 10"
set ::tkcon::OPT(rows) 40
set ::tkcon::OPT(cols) 80
set ::tkcon::OPT(history) 200; # number of commands in history
set ::tkcon::OPT(prompt1) {% };# prompt at start of each input line
# set ::tkcon::OPT(prompt1) {[history nextid] % };# alternative

Author: Harvey Davies       © 2005, CSIRO Australia.       Legal Notice and Disclaimer
CVS Version Details: $Id: scripts.html,v 1.1 2005/03/10 05:50:21 dav480 Exp $