Disable echo in Perl

This is a discussion on Disable echo in Perl within the Tech Board forums, part of the Community Boards category; I want do make a perl script that runs other scripts that compile parts of a project. And if i ...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    167

    Disable echo in Perl

    I want do make a perl script that runs other scripts that compile parts of a project. And if i run with system another script it displayes the whole commands set that the script executes. I want to disable that echo (inhibate it or something like that) so only my script can display messages on the stdin.

    Thank you!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,499
    Can you post an example?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Generally, you redirect the output of "other commands" to /dev/null or NUL: [linux/windows respectively], or if you still want to save the output, redirect to a file. If you want to, you can also redirect stderr by "2>" or "2>&1" - the latter "combines" the stderr with stdout.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Dec 2005
    Posts
    167
    Code:
    ...
    		my $status = system("generate2.bat");
        		if (($status >>=8) != 0) 
    		{
            		die "Failed to generate pp1.txt";
       		}
    ...
    this displays what the generate2.bat echoes. I don't want to see that. How can I stop it from printing? (I'm not allowed to modify the generate2.bat file)

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    As described above:
    Code:
    system("generate2.bat >> NUL:");
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Dec 2005
    Posts
    167
    now it gives me

    Code:
    sh: generate2.bat: command not found

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  2. A breakthrough
    By loopy in forum Linux Programming
    Replies: 4
    Last Post: 11-26-2003, 05:46 PM
  3. C-Shell Scripting.. Help!
    By denizengt in forum Tech Board
    Replies: 3
    Last Post: 10-29-2003, 12:37 PM
  4. perl need help pls.....
    By magnum38 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 12-12-2001, 09:35 PM
  5. echo command
    By Billing in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 08-31-2001, 08:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21