LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-19-2004, 05:36 AM   #1
pedrosan
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;

or

if condition; then
commands
else
commands
fi;

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

PEDROSAN
 
Old 04-19-2004, 06:09 AM   #2
iluvatar
Member
 
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.

greetz,
.-=~ iluvatar ~=-.
 
Old 04-19-2004, 07:42 PM   #3
pedrosan
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

PEDROSAN
 
Old 04-20-2004, 02:23 AM   #4
pedrosan
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.

Bye

PEDROSAN
 
  


Reply



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 02:18 PM
VmWare : can't start any machine fab4am Linux - Software 4 04-11-2005 02:58 AM
Vmware Virtual Machine Problem With Windows In Vmware jvdbossc Linux - Software 2 05-28-2004 06:54 AM
Running Slack 9.1 in a VMWare machine? Dee-ehn Slackware 4 04-20-2004 10:11 AM
vmware virtual machine won't power on Castor Slackware 8 01-07-2004 09:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:07 PM.

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