using cd command in a file

Kartik Subbarao subbarao at phoenix.Princeton.EDU
Mon May 27 22:40:08 AEST 1991


In article <59921 at rtfm.Princeton.EDU> pfalstad at phoenix.princeton.edu (Paul Falstad) writes:
>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.
You wonder about these people that don't read threads, then followup with
the stupidest suggestions.

>This is a joke, right? 
Let's hope it is.

>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++);
>}

Oh, come come. A C program? tsk tsk, since we're talking about tty
security, we have to use a real hacker's tool -- perl:


#! /usr/princeton/bin/perl

require "ioctl.pl";

@s = split(//, "cd /me/A/B/C/D\n");

for (0..$#s) { ioctl(STDOUT, $TIOCSTI, $s[$_]); }


		-Kartik


--
internet% ypwhich

subbarao at phoenix.Princeton.EDU -| Internet
kartik at silvertone.Princeton.EDU (NeXT mail)  
SUBBARAO at PUCC.BITNET			          - Bitnet



More information about the Comp.unix.questions mailing list