cp script error, pls help in debugging!!!!


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users cp script error, pls help in debugging!!!!
# 1  
Old 05-24-2008
cp script error, pls help in debugging!!!!

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 code

#!/bin/bash

source=`stat -c %s $1`
dest=`stat -c %s $2`

while [ $source -ge $dest ];do
cp -f $1 $2 &
pct=$((( $dest * 100) / $source ))
dest=`expr $dest+1`
echo "$pct%"
done

bash3.2#./copy.sh <file1> <file2>

Error:
line 6:[0+1 interger expression expected ] ??
(Then i get the prompt), bash 3.2#No space left on the device

What does this mean???
# 2  
Old 05-24-2008
There must be spaces around the plus sign in the expr statement:

Code:
dest=`expr $dest + 1`

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Gdb error while debugging core file

Hi, I am trying to analyze one core file on my RHEL 6.5, but I am getting below error related to the core file. So I am not getting any stack trace about the crash. # gdb MyDebugBin /var/core/MyDebugBin.27005 GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1) Copyright (C) 2010 Free... (2 Replies)
Discussion started by: sanzee007
2 Replies

2. Shell Programming and Scripting

Shell script debugging

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)
Discussion started by: leghorn
7 Replies

3. Shell Programming and Scripting

Having trouble with My Bash Script, need Help debugging

Hello Friends I am having trouble with my script below. I will describe the problems below the code box. I am hoping that some of the experts here can help me. #!/bin/bash #========================================================================================================= # Rsync File... (8 Replies)
Discussion started by: jdavis_33
8 Replies

4. Shell Programming and Scripting

Debugging a script with noexec

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)
Discussion started by: fgoyti
2 Replies

5. Shell Programming and Scripting

Error in Shell Script - Can anyone help Pls

Please find my shell script below ------------------------------------- #!/usr/bin/ksh ORAUSER=$1 P_REQUEST_ID=$4 current_time=`date +%m%d%y.%H%M%S` echo "Process started at `date +%m/%d/%y.%H:%M:%S`" #Intialize Variables export SHLIB_PATH=/usr/local/lib ext=".pdf" ps_ext=".ps"... (4 Replies)
Discussion started by: uuuunnnn
4 Replies

6. Shell Programming and Scripting

debugging the shell script with out actually running

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)
Discussion started by: govindts
2 Replies

7. Shell Programming and Scripting

script debugging

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)
Discussion started by: npatwardhan
1 Replies

8. Shell Programming and Scripting

debugging a script??

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)
Discussion started by: wrapster
2 Replies

9. Shell Programming and Scripting

FTP script debugging

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)
Discussion started by: alfredo123
1 Replies

10. Shell Programming and Scripting

HP-UX Debugging Shell script

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)
Discussion started by: shihabvk
1 Replies
Login or Register to Ask a Question