Ok, step one. Use the code tags. When you go to create a message and you're including a script, click on the hash mark in the meny above the new message and then include your code.
There are a couple of problems in your script.
1. Don't call functions with the tailing parens. It fails.
2. Don't use ':' as your test statement. It works for if statements but not while statements.
3. Don't put tasks in the variable definitions section. It can get confusing. I moved the rm statement out, especially since you're trying to delete before the path variable was assigned.
4. The script would have run but wouldn't have presented a menu. It's all functions. Somewhere outside of the functions you need to run the first function. I added the commands at the end of the script. They must be after the functions are defined or you'll get a "I don't know what you're talking about" type of error.
I've included the script you provided. I indented, added some extra lines and spaces, and made the necessary corrections. I've highlighted the main changes in red.
In particular, I like having extra space between, for example the data and the open paren in case blocks or between the command and the double semi-colons. It just makes it easier to read, for me at least. And you need to remember that there will be someone else behind you trying to understand what you were doing.
Also, I didn't run through the whole thing to make sure everything was working. I did find a missing read line (highlighted in the script) but there may be other errors. Feel free to ask again if you are still having trouble.
Hi,
I was using AIX - ksh shell , and inorder to debug shell script I used set -vx to echo all the commands which are being executed.
Can anybody tell me the corresponding method in HP-UX - in tcsh shell.
Regards
Shihab (1 Reply)
Hello all,
I am trying to run a script and have not had much success running it...ne help debugging it will be appreciated..The ftp script alone works but not within the while loop.
below is the script
#!/usr/bin/ksh
destination_server=servename
destination_user_id=un... (1 Reply)
Hi all,
Am working on a script to understand the flow control of it..
Since i am from a C background i looking out for an easy way to analyze the script as it runs ..
In C/C++ we have F7 that starts execution from main() and proceeds accordingly..
I was wondering if there is a same approach... (2 Replies)
Hi all,
I searched to find out a few cp scripts that had progress bar, but did not compromise on performance, when my efforts were in vain i went ahead and wrote one of my own ,taking i/p frm other scripts...
But this is causing some errors and am unable to debug it.....pls help
Here is the... (1 Reply)
is there any way you can add a breakpoint in a script so you can stop on it?
i have used -xv in my shebang but the script just runs and i want it to stop at a specific point in the script.
appreciate any help. (1 Reply)
Hello, Some one asked me in the inteview.... The question is,
How do we debug the schell script before even running..... Interviewer
told me one clue... There is SET command to accomplish this... Can any
one tell me what kind of set commands.... Thanks. (2 Replies)
Newbie question. I cannot get "set -n" or "set -noexec on" to work on Linux or AIX! According to the man page and what I read online, it should inform me of syntax errors without executing commands in your script.
So, can someone PLEASE explain why this does not work?
... (2 Replies)
hi all
only the weirdest thing happened with me just now. I was debugging a shell script and I found that a step that was supposed to execute later was getting executed prior to another step for no reason. You know any ?
i mean have a look at the following command-
here it tries to grep... (7 Replies)