From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <102653646721587.tru64-unix-managers.marc@archive.invalid> From: George Gallen Date: Wed, 18 Apr 2001 19:28:09 +0000 To: tru64-unix-managers Subject: Summary: trying to get a script to change directories.... X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=102653646721587 MIME-Version: 1 Content-Type: multipart/mixed; boundary="------_=_NextPart_001_01C0C83D.B4D56B50" This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0C83D.B4D56B50 Content-Type: text/plain; charset="iso-8859-1" At least I wasn't going crazy (well...I take that back). Two options: 1. Create a symlink for current (I'm running an older OS that doesn't have it) 2. use the "." command so typing ". myscript" works from Paul Sand, see the following URL: http://www.faqs.org/faqs/unix-faq/faq/part2/section-8.html and from Alan Davis: Newer versions of the OS include the "current" link. To simulate this in older releases I modifed /sbin/init.d/syslog to do it for me : case "$1" in'start') set `who -r` if [ $9 = "S" ]; then if /usr/sbin/syslogd; then echo "System error logger started" rm /var/adm/syslog.dated/current ln -s /var/adm/syslog.dated/`ls -ct /var/adm/syslog.dated | head -1` /var/adm/syslog.dated/current else echo "Cannot start system error logger" fi fi ;; Thanks to all who responded. Both the above methods are working. George -----Original Message----- From: George Gallen [mailto:ggallen@slackinc.com] Sent: Wednesday, April 18, 2001 3:01 PM To: 'tru64-unix-managers@ornl.gov' Subject: trying to get a script to change directories.... What I'm doing is I want to execute a script which will cd me to the latest syslog files. I'm using the following: cd /var/adm/syslog.dated/`ls -t /var/adm/syslog.dated | head -n 1` If I type it directly, it works, however if I run it as a script, I'm sure the script pid changes directories, but when it ends, I'm back where I was. How do I run the script without forking off a new PID? Thanks George George Gallen Senior Programmer/Analyst Accounting/Data Division ggallen@slackinc.com ph:856.848.1000 Ext 220 SLACK Incorporated - An innovative information, education and management company http://www.slackinc.com ------_=_NextPart_001_01C0C83D.B4D56B50 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable trying to get a script to change directories....
At=20 least I wasn't going crazy (well...I take that = back).
 
Two=20 options:
 
1.=20 Create a symlink for current (I'm running an older OS that doesn't have = it)
2. use=20 the "." command
 
so=20 typing ". myscript" works
 
from=20 Paul Sand, see the following URL:
http://www.faqs.org/faqs/unix-faq/faq/part2/section-8.html

 

and = from Alan=20 Davis:

Newer=20 versions of the OS include the "current" link. To simulate this in = older=20 releases I modifed /sbin/init.d/syslog to do it for me = :

 
case "$1" in'start')
set `who =
-r`
if [ $9 =3D "S" ]; then
if /usr/sbin/syslogd; =
then
echo "System error logger started"
rm =
/var/adm/syslog.dated/current
ln -s /var/adm/syslog.dated/`ls =
-ct /var/adm/syslog.dated | head -1` =
/var/adm/syslog.dated/current
else
echo "Cannot =
start system error =
logger"
fi
fi
;;
 
 
Thanks to all who responded. Both the above methods =
are =
working.
 
George
 
=
-----Original Message-----
From: George Gallen=20 [mailto:ggallen@slackinc.com]
Sent: Wednesday, April 18, = 2001 3:01=20 PM
To: 'tru64-unix-managers@ornl.gov'
Subject: = trying to=20 get a script to change directories....

What I'm doing is I want to execute a = script which=20 will cd me
to the latest = syslog=20 files.

I'm using the following:

cd /var/adm/syslog.dated/`ls -t=20 /var/adm/syslog.dated | head -n 1`

If I type it directly, it works, = however if I run=20 it as a script, I'm sure
the = script pid=20 changes directories, but when it ends, I'm back where =
I was.

How do I run the script without = forking off a new=20 PID?

Thanks
George


George=20 Gallen
Senior=20 Programmer/Analyst
Accounting/Data Division
ggallen@slackinc.com
ph:856.848.1000 Ext = 220=20

SLACK=20 Incorporated -=20 An innovative information, education and management = company=20
http://www.slackinc.com =

------_=_NextPart_001_01C0C83D.B4D56B50--