public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* question about uefi shell-current working directory and shell-script
@ 2018-09-20  9:21 krishnaLee
  2018-09-20 14:21 ` Carsey, Jaben
  0 siblings, 1 reply; 3+ messages in thread
From: krishnaLee @ 2018-09-20  9:21 UTC (permalink / raw)
  To: edk2-devel

Hi,
I wonder if it is a bug:
I have a usb Fat32-disk,installed with EDK2 shell2.6 or 2.7,
the root directory has a startup.nsh,the startup.nsh has only one line:"cd \",
I boot my cannolake machine with this usb disk,
in the uefi shell,I got a message:"cd: current directory not specified".it means the cwd environment variable was not set when start doing script.


I think it may be  an error,because the uefi shell can find the startup.nsh,why not set cwd(current working directory) before execute this script,so the cd command works fine.
I mention it because I found if I put a uefi application(using efi_shell_protocol to access .\logfile.txt) in this startup.nsh,the uefi application can't access files,
 because I found the efi_shell_protocol need cwd to work too,such as efi_shell_protocol.OpenFileByName().






thank you,
krishna




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: question about uefi shell-current working directory and shell-script
  2018-09-20  9:21 question about uefi shell-current working directory and shell-script krishnaLee
@ 2018-09-20 14:21 ` Carsey, Jaben
  2018-09-21  0:30   ` krishnaLee
  0 siblings, 1 reply; 3+ messages in thread
From: Carsey, Jaben @ 2018-09-20 14:21 UTC (permalink / raw)
  To: krishnaLee, edk2-devel@lists.01.org

When the shell starts, it the prompt "shell>" or something like "fs0:>"... The shell may not have a file system assigned yet so you cannot change directories until you pick a file system.

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> krishnaLee
> Sent: Thursday, September 20, 2018 2:22 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] question about uefi shell-current working directory and shell-
> script
> Importance: High
> 
> Hi,
> I wonder if it is a bug:
> I have a usb Fat32-disk,installed with EDK2 shell2.6 or 2.7,
> the root directory has a startup.nsh,the startup.nsh has only one line:"cd \",
> I boot my cannolake machine with this usb disk,
> in the uefi shell,I got a message:"cd: current directory not specified".it means
> the cwd environment variable was not set when start doing script.
> 
> 
> I think it may be  an error,because the uefi shell can find the startup.nsh,why
> not set cwd(current working directory) before execute this script,so the cd
> command works fine.
> I mention it because I found if I put a uefi application(using efi_shell_protocol
> to access .\logfile.txt) in this startup.nsh,the uefi application can't access files,
>  because I found the efi_shell_protocol need cwd to work too,such as
> efi_shell_protocol.OpenFileByName().
> 
> 
> 
> 
> 
> 
> thank you,
> krishna
> 
> 
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: question about uefi shell-current working directory and shell-script
  2018-09-20 14:21 ` Carsey, Jaben
@ 2018-09-21  0:30   ` krishnaLee
  0 siblings, 0 replies; 3+ messages in thread
From: krishnaLee @ 2018-09-21  0:30 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Carsey,
  The shell may not have a file system assigned,
yes but when it find the stript(startup.nsh) file,it has the default file system-->the startup.nsh's file system,
so the default cwd should exist,I think it is strange that start doing script without a default cwd,


currently, without a default cwd,some people have to write ugly script to make a default cwd like this:
if exist fs0:\mytool.efi then
fs0:
goto work_label
if exist fs1:\mytool.efi then
fs1:
goto work_label
if exist fs2:\mytool.efi then
fs2:
goto work_label
if exist fs3:\mytool.efi then
fs3:
goto work_label
...
















At 2018-09-20 22:21:58, "Carsey, Jaben" <jaben.carsey@intel.com> wrote:
>When the shell starts, it the prompt "shell>" or something like "fs0:>"... The shell may not have a file system assigned yet so you cannot change directories until you pick a file system.
>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> krishnaLee
>> Sent: Thursday, September 20, 2018 2:22 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] question about uefi shell-current working directory and shell-
>> script
>> Importance: High
>> 
>> Hi,
>> I wonder if it is a bug:
>> I have a usb Fat32-disk,installed with EDK2 shell2.6 or 2.7,
>> the root directory has a startup.nsh,the startup.nsh has only one line:"cd \",
>> I boot my cannolake machine with this usb disk,
>> in the uefi shell,I got a message:"cd: current directory not specified".it means
>> the cwd environment variable was not set when start doing script.
>> 
>> 
>> I think it may be  an error,because the uefi shell can find the startup.nsh,why
>> not set cwd(current working directory) before execute this script,so the cd
>> command works fine.
>> I mention it because I found if I put a uefi application(using efi_shell_protocol
>> to access .\logfile.txt) in this startup.nsh,the uefi application can't access files,
>>  because I found the efi_shell_protocol need cwd to work too,such as
>> efi_shell_protocol.OpenFileByName().
>> 
>> 
>> 
>> 
>> 
>> 
>> thank you,
>> krishna
>> 
>> 
>> 
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-21  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-20  9:21 question about uefi shell-current working directory and shell-script krishnaLee
2018-09-20 14:21 ` Carsey, Jaben
2018-09-21  0:30   ` krishnaLee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox