Newbie Question 
Author Message
 Newbie Question

Hi, I'm a newbie to perl. Can anyone give me a clue why the following
script fails to execute the "system" call at the end correctly.

#!/usr/local/bin/perl

$port = `tty`;
$port = `basename $port`;
print("Port = $port\n");
$term= $ENV{"TERM"};

if ($port eq "Console") {
        print("Logging in from Console.\n");

Quote:
} else {

        print("\nTerminal($term) ");
        $userselect=<STDIN>;
        chop($userselect);
        if ($userselect) {
                $command = "set term=".$userselect;
        } else {
                $command = "set term=".$term;
        }
        system($command);
        print("\nTerminal = $term\n");

Quote:
}

Thanks in advance.

-John.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=
    _/_/_/_/_/  _/_/_/_/  _/_/_/_/     "I'm not waving
       _/      _/        _/             I'm drowning"              
      _/      _/_/_/    _/_/_/_/              vvv
     _/      _/              _/              (. .)
_/_/_/      _/_/_/_/  _/_/_/_/           ooo0 (_) 0ooo
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=




Fri, 18 Jul 1997 22:45:35 GMT  
 Newbie Question

|> Hi, I'm a newbie to perl. Can anyone give me a clue why the following
|> script fails to execute the "system" call at the end correctly.

<snip>

$term= $ENV{"TERM"};

<snip>

|>      system($command);
|>   print("\nTerminal = $term\n");

Clue 1: It isn't failing to execute the system command correctly (probably).

Clue 2: Obeying $term= $ENV{"TERM"}; doesn't make a permanent connection
        between $term and the environment variable. Changing the
        environment variable won't have any automatic effect on $term.

Clue 3: Changing the environment in a subprocess (as called by system)
        does not change the environment in the calling process.

--
Philip Hazel                   University Computing Service,




Sat, 19 Jul 1997 00:06:32 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie Newbie Question

2. Perl and Apache question. (A newbie question)

3. Question : forms processing in perl - newbie question

4. Newbie question (very stupid question I suppose)

5. Newbie question about SendMail (I think that is what my question is about :)

6. newbie question

7. Newbie question about hashes (and/or arrays)

8. Newbie question: format output

9. newbie question about socket communication

10. dumb newbie question

11. newbie question

12. Newbie Question: File Modification Date!

 

 
Powered by phpBB® Forum Software