lack of understanding > annoying error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting lack of understanding > annoying error
# 8  
Old 05-19-2009
Quote:
Originally Posted by tom_cmu
Your problem is so interesting.
I copy your script and try to execute on my server. Unfortunatly, I am using Solaris 9.5.
So, except the tar option that may different use between Solaris 9 and 10. ( I put comment on this statement). I run your script but I do not find any error as same as you are.

So, please try "truss" command to trace echo on the step that your script is running.
Fore example :
$ truss sh ./backup.sh

Thanks for your time, really! I ran:
Code:
truss -o trussOut sh./backup.sh

I'm not completely sure how this truss command works, aside from its man page's explanation (and the output it produced is 241 lines of stuff that looks over my head) - I would paste it, but previewing my post with a paste of it is showing that it doesn't get its only scrolly frame and instead is HUGE. So i'm attaching it. Let me know if ANY one comes up with anything.

maybe someone can tell me that the way i'm going about my end product is ridiculous and I should be doing it differently?
# 9  
Old 05-19-2009
The another try.
Please try to use
if [ $work -eq "STARTING" ]
instead of
if [ $work = "STARTING" ]
# 10  
Old 05-19-2009
Why don't you use:

test [ -d $toBackUpDir ]

instead of

if [ -d $toBackUpDir ]

the option -d <file> should use with test command,isn't it?
# 11  
Old 05-19-2009
Your if statement may not correct.
Since the -f <file>, -z <file> should use in test statement instead of if cause.
# 12  
Old 05-19-2009
Quote:
Originally Posted by tom_cmu
The another try.
Please try to use
if [ $work -eq "STARTING" ]
instead of
if [ $work = "STARTING" ]
I've tried this before and I get and error explaining that "eq" is for mathematical tests, after looking it up I found that indeed its = that's used for strings.
Quote:
Originally Posted by tom_cmu
Why don't you use:

test [ -d $toBackUpDir ]

instead of

if [ -d $toBackUpDir ]

the option -d <file> should use with test command,isn't it?
Ahhh - just the kind of advice I was looking for! (I'm still quite new to UNIX).

I tried your suggestion with test, but get this (with and without quotes):
Code:
backup.sh: 131: Syntax error: EOF in backquote substitution

I now am using (according to the wikipedia outline of test):
Code:
if test -d "$toBackUpDir"

but alas, the above gives the same exact error I've been getting:

Code:
backup.sh: 29: Syntax error: end of file unexpected (expecting "fi")

incase my code has changed drastically since my initial post, I've attached an updated copy.
# 13  
Old 05-20-2009
Oop! I give you a wrong syntax.
please use test within if cause fore example:
#!/bin/sh
cfile="./download"
if test -d $cfile
then
echo "$cfile is exist "
ls -l $cfile
else
echo "can not find $cfile"
fi
# 14  
Old 05-20-2009
this script has been tested. if you can use it on your site. Then you can apply it to your script.

Last edited by tom_cmu; 05-20-2009 at 01:56 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I get out of the annoying > in bash???

Occasionally I make a mistake in my shell that results in there being a > for the prompt instead of the normal $. Today I accidentally left off a " in a sed command, sed s/\"//g" infile > outfile and then I get $ sed s/\"//g" infile > outfile > > I have never figured out how to get... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

2. IP Networking

Lack of IP Connectivity

Hi Can any one please help identify the issue in scenario 2: Connectivity Diagram: 1) Distribution Switch----Int_Switch----LabSwitch(Fa1/0)----Terminal Ser 2) Distribution Swtich----Int_Swtich----LabSwitch(Fa2/0)----3640 Router ---all links are access links Distribution Switch... (0 Replies)
Discussion started by: sureshcisco
0 Replies

3. Shell Programming and Scripting

Syntax error, not understanding the issue?

Close please. Refer to following thread: Sub Menu issues (2 Replies)
Discussion started by: Banned
2 Replies

4. UNIX for Advanced & Expert Users

Annoying in VI editor

Dear all, I try to search " ( double quote ) in a file using vi editor, I gave in the command mode /" it supposed to take to me to all the occurnces of " instead in some places it is taking me to different character.! It happens with some other characters in that file.... can you... (5 Replies)
Discussion started by: shahnazurs
5 Replies

5. Shell Programming and Scripting

Need help understanding perl script error

I solicited this site earlier this week and got a good answer for a perl Script so I made this script from what understood from the answers But now I have a bug and I'm stump. It doesn't parse correctly the Output it stays on the first line My $f2 and reprints in a endless loop I'm sure there... (3 Replies)
Discussion started by: Ex-Capsa
3 Replies

6. Shell Programming and Scripting

Help understanding syntax error Issue

Hi i as you may already know i am creating a menu driven program. I have chosen to take the approach of implementing each interface individually, after adding another interface and attempting to run the program i am faced with the following error: ./Assigntest: line 32: syntax error near... (6 Replies)
Discussion started by: warlock129
6 Replies

7. Post Here to Contact Site Administrators and Moderators

Annoying tooltips

Hi Is there any way to turn off the (often ridiculously big) tooltips that are displayed when hovering over a topic in a topic list? It's driving me nuts. Thx. J (1 Reply)
Discussion started by: jgrogan
1 Replies

8. Shell Programming and Scripting

Very ANNOYING Problem - Please Help

Hey Guys I have an extremely annoying problem with regular expressions! At this point i believe the command 'read' is causing the problem due to the carriage return it places once its done. I have an continuous loop until the input is correct: (After initial read statement) while ... (7 Replies)
Discussion started by: shadow0001
7 Replies

9. UNIX for Dummies Questions & Answers

a very annoying problem

hi i got fbsd here,when i try to start my X server as an user I got hte following error. Fatal server error: xf86OpenConsole: Server must be running with root permissions You should be usig Xwrapper to start the server or xdm. We strongly advise against making the server SUID root! But... (2 Replies)
Discussion started by: Stormpie
2 Replies
Login or Register to Ask a Question