tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: George Gallen <ggallen () slackinc ! com>
To: tru64-unix-managers
Subject: Summary (Update): trying to get a script to change directories...	.
Date: Wed, 18 Apr 2001 19:30:52 +0000	[thread overview]
Message-ID: <102653646721588.tru64-unix-managers.marc@archive.invalid> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="------_=_NextPart_001_01C0C83E.14646400", Size: 9379 bytes --]

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_01C0C83E.14646400
Content-Type: text/plain;
	charset="iso-8859-1"

Also mentioned by a couple people, using "source" in csh
use of the "." was for sh
and the symlink works for all of them.
 
George

-----Original Message-----
From: George Gallen [mailto:ggallen@slackinc.com]
Sent: Wednesday, April 18, 2001 3:28 PM
To: 'tru64-unix-managers@ornl.gov'
Subject: Summary: trying to get a script to change directories....


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>
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 <http://www.slackinc.com>  


------_=_NextPart_001_01C0C83E.14646400
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<TITLE>trying to get a script to change directories....</TITLE>

<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D710013019-18042001>Also=20
mentioned by a couple people, using "source" in csh</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D710013019-18042001>use of=20
the "." was for sh</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D710013019-18042001>and=20
the symlink works for all of them.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D710013019-18042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D710013019-18042001>George</SPAN></FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader><FONT face=3D"Times New Roman"=20
  size=3D2>-----Original Message-----<BR><B>From:</B> George Gallen=20
  [mailto:ggallen@slackinc.com]<BR><B>Sent:</B> Wednesday, April 18, =
2001 3:28=20
  PM<BR><B>To:</B> 'tru64-unix-managers@ornl.gov'<BR><B>Subject:</B> =
Summary:=20
  trying to get a script to change directories....<BR><BR></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D310532419-18042001>At=20
  least I wasn't going crazy (well...I take that =
back).</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D310532419-18042001></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D310532419-18042001>Two=20
  options:</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D310532419-18042001></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D310532419-18042001>1.=20
  Create a symlink for current (I'm running an older OS that doesn't =
have=20
  it)</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D310532419-18042001>2.=20
  use the "." command</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D310532419-18042001></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D310532419-18042001>so=20
  typing ". myscript" works</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D310532419-18042001></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D310532419-18042001>from=20
  Paul Sand, see the following URL:</SPAN></FONT></DIV>
  <DIV><FONT color=3D#0000ff><SPAN class=3D310532419-18042001><A=20
  =
href=3D"http://www.faqs.org/faqs/unix-faq/faq/part2/section-8.html"><FON=
T=20
  face=3DArial=20
  =
size=3D2>http://www.faqs.org/faqs/unix-faq/faq/part2/section-8.html</FON=
T></A></DIV>
  <DIV>
  <P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
  <P><SPAN class=3D310532419-18042001><FONT face=3DArial size=3D2>and =
from Alan=20
  Davis:</FONT></SPAN></P>
  <P><SPAN class=3D310532419-18042001></SPAN><SPAN =
class=3D310532419-18042001><FONT=20
  face=3D"Courier New" color=3D#0000ff size=3D2><SPAN =
class=3D451275618-18042001>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 =
:</SPAN></FONT></P>
  <DIV><FONT face=3D"Courier New" color=3D#0000ff size=3D2><SPAN=20
  class=3D451275618-18042001></SPAN></FONT>&nbsp;</DIV><SPAN=20
  class=3D451275618-18042001><PRE>case "$1" in'start')</PRE><PRE>set =
`who -r`</PRE><PRE>if [ $9 =3D "S" ]; then</PRE><PRE>if =
/usr/sbin/syslogd; then</PRE><PRE>echo "System error logger =
started"</PRE><PRE>rm /var/adm/syslog.dated/current</PRE><PRE>ln -s =
/var/adm/syslog.dated/`ls -ct /var/adm/syslog.dated | head -1` =
/var/adm/syslog.dated/current</PRE><PRE>else</PRE><PRE>echo "Cannot =
start system error =
logger"</PRE><PRE>fi</PRE><PRE>fi</PRE><PRE>;;</PRE><PRE>&nbsp;</PRE><PR=
E>&nbsp;</PRE><PRE>Thanks to all who responded. Both the above methods =
are =
working.</PRE><PRE>&nbsp;</PRE><PRE>George</PRE><PRE>&nbsp;</PRE></SPAN>=
</SPAN></SPAN></FONT></DIV>
  <BLOCKQUOTE dir=3Dltr=20
  style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff =
2px solid; MARGIN-RIGHT: 0px">
    <DIV class=3DOutlookMessageHeader><FONT face=3D"Times New Roman"=20
    size=3D2>-----Original Message-----<BR><B>From:</B> George Gallen=20
    [mailto:ggallen@slackinc.com]<BR><B>Sent:</B> Wednesday, April 18, =
2001 3:01=20
    PM<BR><B>To:</B> 'tru64-unix-managers@ornl.gov'<BR><B>Subject:</B> =
trying to=20
    get a script to change directories....<BR><BR></FONT></DIV>
    <P><FONT face=3DArial size=3D2>What I'm doing is I want to execute =
a script=20
    which will cd me</FONT> <BR><FONT face=3DArial size=3D2>to the =
latest syslog=20
    files.</FONT> </P>
    <P><FONT face=3DArial size=3D2>I'm using the following:</FONT> </P>
    <P><FONT face=3DArial size=3D2>cd /var/adm/syslog.dated/`ls -t=20
    /var/adm/syslog.dated | head -n 1` </FONT></P>
    <P><FONT face=3DArial size=3D2>If I type it directly, it works, =
however if I run=20
    it as a script, I'm sure</FONT> <BR><FONT face=3DArial size=3D2>the =
script pid=20
    changes directories, but when it ends, I'm back where</FONT> =
<BR><FONT=20
    face=3DArial size=3D2>I was.</FONT> </P>
    <P><FONT face=3DArial size=3D2>How do I run the script without =
forking off a new=20
    PID?</FONT> </P>
    <P><FONT face=3DArial size=3D2>Thanks</FONT> <BR><FONT face=3DArial =

    size=3D2>George</FONT> </P><BR>
    <P><B><FONT face=3D"Times New Roman" color=3D#800000 =
size=3D2>George=20
    Gallen</FONT></B> <BR><FONT face=3D"Times New Roman" =
color=3D#800000=20
    size=3D2>Senior Programmer/Analyst</FONT> <BR><FONT face=3D"Times =
New Roman"=20
    color=3D#800000 size=3D2>Accounting/Data Division</FONT> <BR><FONT=20
    face=3D"Times New Roman" color=3D#800000 =
size=3D2>ggallen@slackinc.com</FONT>=20
    <BR><FONT face=3D"Times New Roman" color=3D#800000 =
size=3D2>ph:856.848.1000 Ext=20
    220</FONT> </P>
    <P><B><FONT face=3D"Times New Roman" color=3D#800000 size=3D2>SLACK =

    Incorporated</FONT></B><FONT face=3D"Times New Roman" =
color=3D#800000 size=3D2>=20
    -<I> An innovative information, education and management =
company</I></FONT>=20
    <BR><U><FONT face=3D"Times New Roman" color=3D#0000ff size=3D2><A =
target=3D_blank=20
    =
href=3D"http://www.slackinc.com">http://www.slackinc.com</A></FONT></U> =

  </P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C0C83E.14646400--

                 reply	other threads:[~2001-04-18 19:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox