using cd command in a file

Paul Falstad pfalstad at phoenix.princeton.edu
Mon May 27 18:03:22 AEST 1991


rmk at rmkhome.UUCP (Rick Kelly) wrote:
>A two line script would do it.
>
>#!/bin/sh
>cd /me/A/B/C/D
>
>Then chmod +x scriptname.

This is a joke, right?

A C program will do it, using everyone's favorite ioctl (since tty
security is a hot topic these days):

#include <sys/ioctl.h>
main()
{
char *s="cd /me/A/B/C/D\n";

   while(*s)
      ioctl(0,TIOCSTI,s++);
}
--
Paul Falstad                     | 10 PRINT "PRINCETON CS"
pfalstad at phoenix.princeton.edu   | 20 GOTO 10



More information about the Comp.unix.questions mailing list