[Solved] ksh script - can't figure out what's wrong
Hi! (I guess this could of gone into the scripting forum, but Unix for Dummies seemed more appropriate. Please note that I am not in school, so Homework doesn't seem appropriate either. You guys can let me know if you think otherwise.)
I am following an exercise in a book on ksh scripting which is supposed to be about boolean operators. While I've added my own lame lines to print, and made changes mentioned below, I've otherwise copied from the book. This is the error I receive:
Now, I'm a total noob, and I'm probably missing something obvious, but no matter how hard I stare at lines 6 and 20, I cannot see anything wrong, especially not with the quotes. I mean, line 6 couldn't be simpler:
The syntax in the book for the variables was as follows:
I thought maybe that was it, because in previous examples they'd shown the syntax more like this:
And they had emphasized how important white space was in ksh scripting, (although they never said exactly how). But changing it didn't make any difference. Even if it's not related to the error, I wouldn't mind hearing a comment about that.
But the fact is, I ran it in debug mode, and it never gets past my inputting the data, so the problem does seem to be line 6.
Here is the script:
Last edited by sudon't; 11-22-2012 at 07:19 PM..
Reason: forgot something
Do not type up your scripts in Microsoft Word, it will convert your ordinary quotes into "smart quotes" which aren't quotes at all as far as the shell's concerned.
Do not type up your scripts in Microsoft Word, it will convert your ordinary quotes into "smart quotes" which aren't quotes at all as far as the shell's concerned.
Actually, I was using vim, but after I got the error the first time, I opened it in TextWrangler, and added the missing quotes. I see now that I had the prefs set to use "typographers quotes". But I guess my eyesight wasn't good enough to notice.
Ok, I changed prefs and replaced the curly quotes, and it works as expected. That was it, thanks!
Moderator's Comments:
edit by bakunin: Great! Changed the threads title to [Solved].
Hi,
I am trying to write a script that calls an Oracle SQL file who in turns call another SQL file. This same SQL file has to be run against the same database but using different username and password at each loop.
The first SQL file is basically a connection test and it is supposed to sort... (2 Replies)
I am trying to run following script in ksh on darwin 11.4.2:
freeSpace=2469606195
spaceNeeded=200
] && echo "no space" || echo "space available"
] && echo "no space" || echo "space available"
"-lt" is giving wrong answer as "no space" Whereas '<' works fine. When I change the freespace... (4 Replies)
I'm looking at a line in a script:
&& DRROOT="/dir1" || DRROOT="/dir2" I'm trying to understand it.
Is there a "-d" command and is it seeing if /dir1 exists and, if so, set an environment variable named DRROOT to "/dir1", else set DRROOT to "/dir2" ?
Thanks,
-dog
---------- Post... (0 Replies)
Gey guys,
I'm a new learner of perl. Now I encountered a problem when I tried to get the output below from the input file.
Input:
5'h1f, 16'h8210
write, 5'h10, 16'h0000
write, 5'h11, 16'h0000
5'h1f, 16'hffd0
write, 5'h1e, 16'h0000
5'h1f, 16'h8310
read, 5'h10, rd_data
5'h1f,... (3 Replies)
The syntax of 'if' conditionals in bash and ksh seems different. I am trying to check for a particular version using 'if' in ksh. This very simple syntax gives syntax error. I have tried many variants, but no go. Please correct the syntax. Later I will expand it to 'if' and 'else'.
#!/bin/ksh... (8 Replies)
I just put together a script for work that will essentially automate the migration of our Windows fileserver to my newly created Debian based SAMBA server.
My script will create the necessary directories then copy the data over to my new server, after that it will set the ACL's by using... (3 Replies)
Before I begin with the question, I just want to point out that I just started learning unix in the middle of last week, so my code (and knowledge of how unix operates) is weak sauce. I took my best stab at this question but it's just not working.
Assignment:
Create a script named... (1 Reply)
Hi
I have a small function which returns a wrong value.
The function tries to make a connection to oracle database and tries to get the open_mode of the database in the variable status.
However when a database is down the value of the status column is set to READWRITE i am not sure why.
I... (0 Replies)
I wrote this code and did not know what did I do wrong ??
## get the first line of this file
AFIRST=$(head -1 rss-cs-3423a-20051211-060001.dat)
#CJKA|2005-12-10 08.01.30.000000|1111111111|ECI|1112221111|1113331111|1114441111 <--- this is a answer
## Third line of stat file
BTHREE=$(cat... (11 Replies)