Results 1 to 6 of 6
I can't seem to get the following code to give me anything other than "Data not found". I have the target directories in the same directory as the script that ...
- 03-09-2007 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 3
scritping question
I can't seem to get the following code to give me anything other than "Data not found". I have the target directories in the same directory as the script that I am running. I know that the error is in the "if" statement, but I can't seem to figure it out. Any suggestions would be greatly appreciated!
echo "Enter dataset/s to tar and gzip.--> \c"
read dat
totsize=0
mul=0
if [ ! -f $dat -a $# -eq 0 ]
then
echo Data not found, check your entry and resubmit.
exit
else
- 03-09-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
$# gives the number of command line arguments.
Have you pass arguments to your script?
Regards
- 03-12-2007 #3Just Joined!
- Join Date
- Mar 2007
- Posts
- 3
The lines before my if statement are where I input values. It's supposed to be dynamic.
- 03-12-2007 #4Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
OK, but that wasn't the question
Originally Posted by Stevenh
Regards
- 03-13-2007 #5
Make life easier with the bash debugger.
bash -x your_script_here
Post the output...
- 03-13-2007 #6Just Joined!
- Join Date
- Mar 2007
- Posts
- 3
I found out that what I needed to use was a "-d" not "-f". It works fine now. To answer your other question, Yes, I had passed the arguments to my script. Thank you Franklin52.
I'll save the debugger for future problems.


Reply With Quote