But since the only checking of the echo state happens in the else statement of 
the if that we are already inside of. We could just ignore it entirely since we 
inherently skipped the printout.   When I say ignore "it", I mean ignore both 
the set to FALSE, and the restore.  

But since this entire function gets called again with a new script file, we 
need to set the global setting.

          if (CommandLine3[0] == L'@') {
            //
            // We need to save the current echo state
            // and disable echo for just this command.
            //
            PreCommandEchoState = ShellCommandGetEchoState();
            ShellCommandSetEchoState(FALSE);
            Status = RunCommand(CommandLine3+1);

            //
            // Now restore the pre-'@' echo state.
            //
            ShellCommandSetEchoState(PreCommandEchoState);
          } else {
            if (ShellCommandGetEchoState()) {
              CurDir = ShellInfoObject.NewEfiShellProtocol->GetEnv(L"cwd");
              if (CurDir != NULL && StrLen(CurDir) > 1) {
                ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_CURDIR), 
ShellInfoObject.HiiHandle, CurDir);
              } else {
                ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_SHELL), 
ShellInfoObject.HiiHandle);
              }
              ShellPrintEx(-1, -1, L"%s\r\n", CommandLine2);
            }
            Status = RunCommand(CommandLine3);
          }

-----Original Message-----
From: Tim Lewis [mailto:tim.le...@insyde.com] 
Sent: Tuesday, February 12, 2013 11:12 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] @echo -off doesn't work in a script

Jaben --

I thought the other case was

1. echo is on
2. @other-command turns off echo temporarily 3. echo is restored back on

Tim

-----Original Message-----
From: Carsey, Jaben [mailto:jaben.car...@intel.com]
Sent: Tuesday, February 12, 2013 11:09 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] @echo -off doesn't work in a script

I think the restore there is designed to handle the case where the script calls 
another script with @

script1.nsh
@script2.nsh

I don't think that any other case requires the restoration of the echo state.

-Jaben

-----Original Message-----
From: Tim Lewis [mailto:tim.le...@insyde.com]
Sent: Tuesday, February 12, 2013 10:57 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] @echo -off doesn't work in a script

The problem is in Shell.c: 

          if (CommandLine3[0] == L'@') {
            PreCommandEchoState = ShellCommandGetEchoState();
            ShellCommandSetEchoState(FALSE);
            Status = RunCommand(CommandLine3+1);

            //
            // Now restore the pre-'@' echo state.
            //
            ShellCommandSetEchoState(PreCommandEchoState);
}

If the command is echo, it restores the state prior to the echo command. 


-----Original Message-----
From: Stephen Polkowski [mailto:step...@centtech.com]
Sent: Tuesday, February 12, 2013 10:49 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] @echo -off doesn't work in a script

Yes, that is my point.  There is no way to hide the echo -off command in the 
2.0 shell.  If you use the @ with "echo -off" it will fail to disable echo for 
sub-sequent commands.

file:  hello.nsh

@echo -off
echo "Hello World"

output:

2.0 FS0:\> hello.nsh
2.0 FS0:\> echo "Hello World"
Hello World
2.0 FS0:\>

Is this a feature?

Thanks,

Stephen

Tim Lewis wrote:
> Laurie --
> 
> Is this a bug, then? Chapter 4 of the UEFI Shell spec says: "Also, additional 
> '@' before a command in a script file can prevent the current command from 
> being echoed"
> 
> 
> -----Original Message-----
> From: Jarlstrom, Laurie [mailto:laurie.jarlst...@intel.com]
> Sent: Tuesday, February 12, 2013 10:12 AM
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] @echo -off doesn't work in a script
> 
> The results are different with UEFI Shell 2.0.  The initial "@" needs to be 
> removed for UEFI Shell 2.0.  
> 
> thanks,
> Laurie
>  
> laurie.jarlst...@intel.com
> EFI / Framework Technical
> Marketing Engineering Team
> (503) 712-9395
> 
> -----Original Message-----
> From: Jarlstrom, Laurie [mailto:laurie.jarlst...@intel.com]
> Sent: Tuesday, February 12, 2013 9:55 AM
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] @echo -off doesn't work in a script
> 
> I just tried the attached scripts on the UDK2010.SR1.UP1 Nt32 emulation and 
> the shell "echo" worked as per the screen capture attached Try the scripts 
> attached.
> 
> 
> thanks,
> Laurie
>  
> laurie.jarlst...@intel.com
> EFI / Framework Technical
> Marketing Engineering Team
> (503) 712-9395
> -----Original Message-----
> From: Stephen Polkowski [mailto:step...@centtech.com]
> Sent: Tuesday, February 12, 2013 9:19 AM
> To: edk2-devel@lists.sourceforge.net
> Subject: [edk2] @echo -off doesn't work in a script
> 
> Hi all,
> 
> Shouldn't @echo -off work in a .nsh script.  It doesn't on the latest
> UDK2010.SR1.UP1 shell.  It only hides the echo -off command.  The commands 
> that follow it are echoed to the screen.
> 
> Am I missing something.
> 
> Thanks in advance,
> 
> Stephen
> 
> 
> ----------------------------------------------------------------------
> --------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013 and get the 
> hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> 
> ----------------------------------------------------------------------
> --------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013 and get the 
> hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> 
> ----------------------------------------------------------------------
> --------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013 and get 
> the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


--
Stephen Polkowski
Centaur Technology
Austin, TX
(512) 418-5730

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 and get the 
hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 and get the 
hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 and get the 
hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 and get the 
hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to