dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dmidecode] Re: dmidecode for DOS?


From: Jean Delvare
Subject: Re: [dmidecode] Re: dmidecode for DOS?
Date: Tue, 13 Sep 2005 19:20:35 +0200

Hi Ian,

[Ian Anderson]
> As for the enviromental variables:
> 
> ASSETTAG=`dmidecode -s chassis-asset-tag`
> SERIALNO=`dmidecode -s chassis-serial-number`
> MODEL=`dmidecode -s system-product-name`
> 
> echo set assettag=$ASSETTAG > env.bat
> echo set serialno=$SERIALNO >> env.bat
> echo set model=$MODEL >> env.bat
> 
> does not work under DOS. :(

Of course, this is bourne shell, this is simply not supposed to work
under DOS' command.com. Unfortunately, DOS doesn't exactly qualify as a
friendly scripting environment. Its command interpreter is very poor. At
this point you have two options.

The first possibility is to code the option you need yourself into
dmidecode. Keep in mind though that I will not merge it. This would
violate the Unix rule which states that one tool must do just one thing
and do it well.

The second possibility is to workaround the DOS chronic deficiencies.
This is tricky, and the result is definitely ugly compared to what a
Unix shell allows, but you asked for it.

All you really lack here is an equivalent of Unix' "echo -n". If you had
that, you could do something along these lines:

echo -n set assettag=> env.bat
dmidecode -s chassis-asset-tag>> env.bat
echo -n set serialno=>> env.bat
dmidecode -s chassis-serial-number>> env.bat
echo -n set model=>> env.bat
dmidecode -s system-product-name>> env.bat

Right?

Maybe FreeDOS provides a more convenient version of "echo" than MS-DOS
did, and has an option equivalent to "-n"?

If not, I searched for solutions and found two. Implementation is up to
you. First solution is to prepare non-newline-terminated files with the
strings you need, and to append them to the generated files at the right
time using "type". Such files can be static [1], or can be generated on
the fly using debug [2]. Second solution is a small DOS binary called
ech.com which does exactly "echo -n" [3].

[1] http://www.ericphelps.com/batch/lines/frag-man.htm
[2] http://www.ericphelps.com/batch/lines/frag-dbg.htm
[3] http://www.lanet.lv/ftp/simtelnet/msdos/pcmag/v12n18.zip

Hope that helps.

-- 
Jean Delvare




reply via email to

[Prev in Thread] Current Thread [Next in Thread]