Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-19-2004, 06:36 AM   #1
LQ Newbie
Registered: Apr 2004
Location: Osaka, JAPAN
Posts: 21

Rep: Reputation: 15
Problem to make scripts on a VMWARE Vitual Machine

Hi guys

I am a new UNIX environment user who's got troubles trying to make scripts on a VMWARE virtual machine.

If I use "if" conditions or "for" loops on the shel using the fallowing syntax everything goes well:
$ if condition
> then
> commands
> else
> commands
> fi

But when I put it into a script, when I try to run it, is like if the "then" and "fi" statements where not seen by the VM. And the shell shows messages such as "syntax error" or "uncorrect end of file".

To get rid of these errors, I am obliged to use the following syntax:

if condition; then commands; else commands; fi;


if condition; then

And I don't understand because I thought I was not allowed to put a ";" after the "fi" statement.

I also have troubles with arithmetics expressions. I don't understand why the expressions I found in books or on the web don't work in scripts as they do work on the shell.

Does anyone know where do these problems come from?
Is it me, I may be so bad using UNIX that I didn't find out things?
Is it a bad configuration of VMWARE?

Thank U for your help

Old 04-19-2004, 07:09 AM   #2
Registered: Jul 2003
Location: netherlands
Distribution: debian
Posts: 403

Rep: Reputation: 30
hi there,

did you put #!/bin/bash on the first line? this makes sure the script is executed within the bash enviroment. the ;'s are ok, that's just the way the script is seen by the enviroment.

.-=~ iluvatar ~=-.
Old 04-19-2004, 08:42 PM   #3
LQ Newbie
Registered: Apr 2004
Location: Osaka, JAPAN
Posts: 21

Original Poster
Rep: Reputation: 15
Hi !!!

Thank U for your answer.
I actually put the "#! /bin/bash" at the beginning of my script but I put a space in it. Do you think this was a mistake?
I also put comments before. Do you think this could be wrong to?

I am gonna try to modify this line and I will see.

See U

Old 04-20-2004, 03:23 AM   #4
LQ Newbie
Registered: Apr 2004
Location: Osaka, JAPAN
Posts: 21

Original Poster
Rep: Reputation: 15
I found out where my problem came from.
I was editing my script on Windows and running it on Linux.
The Windows editor added characters without showing them. So when I tried to run it I had errors.




Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Slack in a VMWare Virtual Machine proproductions Slackware - Installation 1 11-22-2005 03:18 PM
VmWare : can't start any machine fab4am Linux - Software 4 04-11-2005 03:58 AM
Vmware Virtual Machine Problem With Windows In Vmware jvdbossc Linux - Software 2 05-28-2004 07:54 AM
Running Slack 9.1 in a VMWare machine? Dee-ehn Slackware 4 04-20-2004 11:11 AM
vmware virtual machine won't power on Castor Slackware 8 01-07-2004 10:35 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration