Undefined variable, TERM
Undefined variable, TERM
- Subject: Undefined variable, TERM
- From: Doug McNutt <email@hidden>
- Date: Wed, 22 Jan 2003 09:39:53 -0700
MacOS neXt 10.2.3, SE 1.9, all announced updates installed.
tell application "Finder"
do shell script "/Users/doug/bin/MountEm"
end tell
This script, as an APPL, normally resides with my startup items. Sometimes, but not always, it fails with message window containing "TERM undefined"
What is TERM ?, The Terminal application? Should I be setting it in environment.plist?
It has happened before while attempting to persuade BBEdit to set an environment variable to the active window's name. This was planned for my .tcshrc script but will never work largely because BBEdit doesn't respond to AppleEvents while a shell operation is in progress. It does not explicitly use $TERM but osascript might though it does not appear in the man page for osascript
#!/bin/tcsh
echo -n "setenv ACTIVE " > ~/bin/temp
osascript -e 'tell application "BBEdit"' -e 'set mine to "echo " & (name of window 1) as string & " >> ~/bin/temp"' -e 'do shell script mine' -e 'end tell'
source ~/bin/temp
--> TERM: Undefined variable.
Since I started working seriously with Apple's new X11 the problem has occurred at every login. (X11 uses an environment variable $TERM.) X11 has not been activated at the time of failure.
For completeness but probably not germane to the AppleScript problem the shell scripts are below. Note that when the error occurs I get no entries in my log file.
### File MountEm ###
#!/bin/tcsh
echo "Entering MountEm" >> $HOME/logs/shel_log
date >> $HOME/logs/shel_log
echo "PATH at entry is "$PATH >> $HOME/logs/shel_log
ps -xww -o user,pid,ppid,pgid,state,start,command >> $HOME/logs/shel_log
source $HOME/bin/SuntideMounter Mimas >> $HOME/logs/shel_log
source $HOME/bin/SuntideMounter Enceladus
source $HOME/bin/SuntideMounter Rhea
source $HOME/bin/SuntideMounter Iapetus
source $HOME/bin/SuntideMounter Hyperion
source $HOME/bin/SuntideMounter Deimos Mars
# if .command added to name (doesn't work, terminal stays open.)
# osascript -e 'tell Application "Terminal" to quit'
exit
### File SuntideMounter ###
#!/bin/tcsh
# Mounts external disks with some assumptions about names and passwords
# The basic idea is to avoid that piece of crap called the keychain.
# Doug McNutt email@hidden
# Released to the public domain without restriction.
if ($#argv < 1) then
echo "### Usage, $0 diskName [AFPserverName [password]]"
exit
endif
set proot = $HOST:r # Earth.local
set myself = $proot:r # Earth
# myself is the name of the machine we're working on.
# Here we will be using it as the username for the external servers.
set theName = $argv[1]
if ($#argv > 1) then
set theMachine = $argv[2]
else
set theMachine = Saturn
# Doug's file server default, an SE/30 running 7.5.3
# Replace it with your own
endif
if ($#argv > 2) then
set thePwd = $argv[3]
else
set thePwd = $myself
# Doug's passwords are the name of the requesting machine
# Replace it with your own default
endif
pushd /Volumes > /dev/null
if (-e $theName) then
echo "skipping "$theName # It's already mounted
else
mkdir $theName
mount_afp afp:/at/${myself}:${thePwd}@${theMachine}/${theName} /Volumes/$theName > /dev/null
if ($? == 0) then
echo "mounting "$theName
else
rmdir $theName
echo problem mounting $theName # Something wrong.
endif
endif
popd > /dev/null
exit
--
--> If you are presented a number as a percentage, and you do not clearly understand the numerator and the denominator involved, you are surely being lied to. <--
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
References: | |
| >(no subject) (From: Joe Ragosta <email@hidden>) |