You are correct about "if [ "$work" = "STARTING" ]".
1. I put
work=""
after your sql_Dir=... statement
2. I modify the statement
echo "PAST LANDING DIR. CHECK with work = $work in the $landingDir copy to $toBackUpDir"
to trace on variable's value
3. I change your if cause script from if [ -<option> <argument>] to if test -<option> <argument>
and execute the script.
I get this.
_______________________________________________________
backup.sh is a shell script designed to backup pre- |
specified files to a pre-specified file path. For |
details see the parameters. - Jonathan Zacsh 5/20/09 |
______________________________________________________|
Script Started: Wed May 20 12:54:52 ICT 2009
---------------
Checking for specified landing directory: ./download/
Directory ./download/ is present and ready to receive backup.
Checking that ./download/ does not contain old backup files.
The variable $tarCheck returns: ./download//super_backup.tar
I am not ready to backup, first download and delete the above mentioned contents of the ./download/ landing directory.
AFTER NESTED ELSE#DEBUG
AFTER NESTED IF
PAST LANDING DIR. CHECK with work = NOT starting in the ./download/ copy to ./tmp
AFTER OUTER-LAYER IF-STATEMENT
Backup sequence ended early.
So it means if you can get this you can continue to fine tune your script.
I hope you will get it.
Note: super_backup.tar is existing in my sudirectory download .
please try this:
tarCheck=`ls $landingDir/*tar*`
instead of belowing.
tarCheck=`ls $landingDir | grep -i *tar*`
haha, I was using such a complicated approach! thanks
Quote:
Originally Posted by tom_cmu
You are correct about "if [ "$work" = "STARTING" ]".
1. I put
work=""
after your sql_Dir=... statement
2. I modify the statement
echo "PAST LANDING DIR. CHECK with work = $work in the $landingDir copy to $toBackUpDir"
to trace on variable's value
3. I change your if cause script from if [ -<option> <argument>] to if test -<option> <argument>
and execute the script.
I get this.
-I did part 1 (pre-setting the variable $work)
-I did part 2 (actually, clarified a few of my "debugger" statements to be more helpful)
-I did part 3 - but, did you only change a few of the if statements to if test? or did you change every if statement in the script to if test? I changed everything to if test
and STILL I'm getting the same exact error:
I've attached my copy of the script. I figure it'll be easier if you do: diff yourCopy myCopy
and let me know what's different? or post your version up and I'll do it.. because I'm thinking maybe I misunderstood one of these many past pieces of advice in this thread, and i'm not on the same page? or maybe you could run my script, and if it works than I'll know its my system that's different (though, i very highly doubt that will be the case)...? shooting for anything here. thanks again
Hi! I change the if cause only that it should use the test command.
I remove some of your comment lines to make it easy to sweep my eyes on it.
I attach the test file to let you take a look on it.
Hi! I change the if cause only that it should use the test command.
I remove some of your comment lines to make it easy to sweep my eyes on it.
I attach the test file to let you take a look on it.
Hope this can help.
OH no! you called it from the beginning but I thought the vi editor which showed line numbers (and it really only did show ONE line number for that entire thing) was enough proof!
Man, I'm sorry tom_cmu. Well atleast I learned how to clean up my code, and not to really rely on the silly logical expectations I have of the software I use. (I only really noticed this when I downloaded my own copy to my xp machine and viewed it with Notepad++, the syntax highlighting is what made it so obvious something was wrong with that line)
removed this, and everything was fine:
Code:
#OLD WAY: #fileName=`date | sed -n s/ /_/g p | sed -n s/^/Backup_/p | sed -n s/$/\.tgz/p | sed -n s/^/$landingDir/p` #NAME OF BACKUP FILE
Thanks again for all the help - this was some seriously awesome community support here, thank you!
ps. is there some way to mark this thread as solved?
This bit is two lines, not one. The second line is therefore not commented out.
Code:
#OLD WAY: #fileName=`date | sed -n s/ /_/g p | sed -n s/^/Backup_/p | sed -n s/$/\.tgz/p | sed -n s/^
/$landingDir/p` #NAME OF BACKUP FILE
I've attached a screen shot of how vi shows the line numbers (on the left-hand side), so that you can understand that the place in this line that you might see the text wrap is not the same place my environment may be wrapping it (wrap, not a line break).
Because I could see that it was a wrap and not a line break:
* the line numbers skip over that part (all shown as line #61)
* the wrap is at dingDir/p` whereas yours is at /$landingDir
I don't see where I could stick a second comment (#).
Looking at that ^ (and the two attachments, one shows the same thing with my terminal sized differently on my desktop) is there something I'm not understanding?
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)
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)
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)
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)
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
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)
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)
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)