Building a script in Ubuntu (Linux) from existing DOS .cmd
Greetings,
I would be very grateful to anyone who is willing to help and knows there scripting and how to convert a DOS CMD script.
In this posting I am also hoping to pass on information to anyone wanting to see a bit of VMware command line stuff.
I have made a script (batch file) that runs great in windows but I want to run it on Ubuntu (9.04 64-bit).
The problem is that dividual commands run independently on the command line, but in a script it doesn't. It seems like only the first command runs and the rest don't really work.
I want to know how best to create the script file and run it. I also want to learn on the way.
I don't have the time to learn more shell scripting right now and want to get the job done. I tried to get it to work but it all just behaves strangely.
I created this script to quickly deploy 3 VMware virtual machines (2 are clones from a base image and one gets unzipped). The script does fancy stuff like change the vmnets and adjust the memory and display names of the new VMs. The idea is to use them and then later redeploy them afresh.
I will use something like "/home/administrator/vmware/Virtual Machines" instead of "c:\Virtual Machines" and /usr/bin/vmware instead of vmware.exe
Here is the working DOS script and below some conversion that I have created
===================================================
===================================================
END
Conversions
========
This is the base image being used to make a linked clone, to later be called pc1
/usr/bin/vmrun -T ws clone "/home/administrator/vmware/Virtual Machines/CheckPoint/XPVM/Windows XP Pro.vmx" "/home/administrator/vmware/Virtual Machines/CheckPoint/England/pc1/pc1.vmx" linked
This replaced the vb script (cscript replace (above)) for replacing text values in the file:
rpl "Clone of Windows XP Pro" "pclondon" "/home/administrator/vmware/Virtual Machines/England/pc1/pc1.vmx"
Greetings,
I would be very grateful to anyone who is willing to help and knows there scripting and how to convert a DOS CMD script.
In this posting I am also hoping to pass on information to anyone wanting to see a bit of VMware command line stuff.
I have made a script (batch file) that runs great in windows but I want to run it on Ubuntu (9.04 64-bit).
The problem is that dividual commands run independently on the command line, but in a script it doesn't. It seems like only the first command runs and the rest don't really work.
I want to know how best to create the script file and run it. I also want to learn on the way.
I don't have the time to learn more shell scripting right now and want to get the job done. I tried to get it to work but it all just behaves strangely.
Can you show us what you've tried? You may be halfway there already.
Sure (see below). Thanks for your response.
I just recreated most of it (I hadn't saved it all and deletes the last version of file)
The main problem is that the first line or two of the script works and then each one after that doesn't. But each line pasted into a terminal works fine. I just donw want to have to run it all manually each time or run a seperate script for each line!
So I just don't know how to get the script to run each line properly as an independent command.
I get errors like this:
"errors:
Creating VMs ....
Error: Invalid clone type: must be "full" or "linked"
" not found.home/administrator/vmware/Virtual Machines/VMs/England/pc1/pc1.vmx
PC 1."
The 7z command has '-o"text"', does it require a space?
You might try single quotes around the vmx files. From the first error it appears to be dropping a parameter. Further debugging could be done with...
You would also need to check what happened to the leading '/' on the path for pc1.vmx. Did the 'rpl' script remove it?
Last edited by m1xram; 12-14-2009 at 06:50 PM..
Reason: eureka! found it
Thanks for that. I need some time to obsorb and test it but to answer your question in the meantime:
The 7z command and switches are formatted correctly. It is just like that with 7z.
I am trying to read this stuff: UNIX / Linux Bourne / Bash Shell Scripting Tutorial [ steve-parker.org ] and I see there is plenty to read here too.
Will respond later.
Thanks for the REM comment/reply. I know this much now from steve-parker and you. I appreciate the feedback and lessons.
Hello all,
I am looking for a way to copy the existing Ubuntu server 12.04 to a USB (with all the packages and such) and make it boot from the USB.
I have seen other threads about copying the CD image to the USB, which is not exactly I am looking for.
Before I start diving into anything I... (4 Replies)
1. What I am doing?
Building a DOS .bat file that will root my Droid 2 phone using adb commands in the .bat file. (Just for the fun of it and to help me learn "stuff".)
2. Problem:
Here are the problem steps to accomplish this task manually in an adb shell:
adb shell (Prompt is $)
cd... (2 Replies)
I have two PCs with Ubuntu 10.4 and DOS 5.0, which are connected with a 9 pins serial cable.
I need to copy some files from the Linux box to the DOS box.
I tried UUCP but it's too difficult and i didn't found a working client for DOS.
Can you help me? Thanks for any reply! (10 Replies)
I need to write a batch script for file transfer from SFTP to Windows system. SFTP is on Linux system. I kept this code in batch file and executing it.. but not working.. Even i tried from Command prompt like this "open sftp.host.com" but getting error. Can anyone help with the code and tell me how... (15 Replies)
Hi,
I have an awk script which performs simple operations of variable assignments and finally printing the variables in custom form.
BEGIN {FS=OFS="\n"}
{
v1=substr($0,1,15)
v2=substr($0,16,200)
v3=substr($0,216,20)
print v1 "|" v2 "|" v3
}
The input file being processed... (2 Replies)
I'm trying to customize my environment at work in a Unix system.
So I'm starting with the ls command...
I'd like to make it run as the Linux ls...
Even in color, if possible...
My first problem is to make the file listing brake in columns...
In fact, the actual ls from Unix does this, but... (3 Replies)
Hello,
I am trying to accomplish the following.
Send the output of a command to the screen (this happens by default) as well as capture the output of the screen to a log file.
How can this be achieved in DOS command interpreter syntax.
Any ideas/suggesstions/indicators are greatly... (2 Replies)
Hi guys. I'm in desperate need of a program that can allow me to write files to different sectors of a disk (floppy), in the same way the DOS Debug program can (with a command such as -w 100 0 0 1 to write the bootsector of the disk).
Does anyone know any links or names of programs that could... (2 Replies)