Sponsored Content
Full Discussion: While Loop - stange error
Top Forums Shell Programming and Scripting While Loop - stange error Post 302238326 by caddyjoe77 on Friday 19th of September 2008 03:20:11 PM
Old 09-19-2008
Thanks, i found another error so i will re write it in the korn shell. I was also wanting to change it so that i am putting the cp -p in the background and performing some math operations to let the user know that their copy is still in progress.

and yes, it was not a direct copy and paste, so the errors that you all found were definitely errors.

Thanks for your inputs again! Happy scripting
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Stange problem Dell PowerEdge 1950/ Boradcom Netextreme NIC

I have 2 Dell Poweredge 1950 servers running . I have been having intermittent performance issues with the NIC cards on one of them. The two servers are identical and are running the same operating system. The server that has the issue is on the DMZ on a a static IP and is hosting a website. ... (0 Replies)
Discussion started by: skotapal
0 Replies

2. Shell Programming and Scripting

while loop error

while read line do echo "read line is $line" done < $file where $file is file having following contents 1=one 2=two 3=three but above while loop is not able to print last line !! why ? (3 Replies)
Discussion started by: crackthehit007
3 Replies

3. IP Networking

netperf reslt TCP_RR TCP_STREAM is stange,help me

send byte=10 , I test two target, A and B different os. The TCP_STREAM' s result is higher than B but TCP_RR result is lower than B why? please help me (0 Replies)
Discussion started by: yanglei_fage
0 Replies

4. Solaris

Error in while loop

Hi, Iam trying to add a while loop in my script in the below way which gets value from count file and checks if its not equal to 0.If yes then it shld echo me a message. while //count file has some number other than 0 do echo "count is not zero" done But iam getting this error:... (5 Replies)
Discussion started by: jyothi_wipro
5 Replies

5. UNIX for Dummies Questions & Answers

error in for loop???

Hi, I get the following output 98 -1 98 0 ./get_AB04-time: line 79: ((: i< && 0 !=7 : syntax error: operand expected (error token is "&& 0 !=7 ") I have this part of code. Line 79 is the line of the for loop. echo ${OCCURRENCE} $i_START CASE=0; i_END=${i_START}... (4 Replies)
Discussion started by: f_o_555
4 Replies

6. Shell Programming and Scripting

Error Using an if Loop Within a While Loop

Hello All, I am having a problem with an “if loop” within a “while loop” in my Korn Shell program. The basic concept of the program is that it searches for the existence of a series of load files in a load directory, and once it finds one of these files, it begins the following process: · Creates... (4 Replies)
Discussion started by: jonesdk5
4 Replies

7. Shell Programming and Scripting

Error with while loop

the program just prints all the command line arguments Getting error in the program error ./hellow: line 13: 0: command not found ./hellow: line 13: 0: command not found below is the program #!/bin/bash num=$# echo $num if then echo "No arguments are passed ." else ... (7 Replies)
Discussion started by: BHASKARREDDY006
7 Replies

8. Shell Programming and Scripting

Error in while loop

I have a file Table.out having table name like this Table_Emp Table_Exp Table_Fcr To show first 10 rows .. I' wrtng a script like this .. #!/bin/ksh cat /tmp/table.out|while read -r table vbar1 do <connect to db> then select * from $table limit 10; > /tmp/1.out done ... (3 Replies)
Discussion started by: netdbaind
3 Replies

9. Shell Programming and Scripting

Error in for loop

I was trying to implement a nested for do loop to run a perl script. for i in 1 10 50 do for j in 2 12 55 do perl script.pl "$i" "$i" "$j" done done when I implemented it within a shell script, i got the output, but every time j value will 55, or basically the last value of j in... (10 Replies)
Discussion started by: Kanja
10 Replies
fcopy(n)						       Tcl Built-In Commands							  fcopy(n)

__________________________________________________________________________________________________________________________________________________

NAME
fcopy - Copy data from one channel to another. SYNOPSIS
fcopy inchan outchan ?-size size? ?-command callback? _________________________________________________________________ DESCRIPTION
The fcopy command copies data from one I/O channel, inchan to another I/O channel, outchan. The fcopy command leverages the buffering in the Tcl I/O system to avoid extra copies and to avoid buffering too much data in main memory when copying large files to slow destinations like network sockets. The fcopy command transfers data from inchan until end of file or size bytes have been transferred. If no -size argument is given, then the copy goes until end of file. All the data read from inchan is copied to outchan. Without the -command option, fcopy blocks until the copy is complete and returns the number of bytes written to outchan. The -command argument makes fcopy work in the background. In this case it returns immediately and the callback is invoked later when the copy completes. The callback is called with one or two additional arguments that indicates how many bytes were written to outchan. If an error occurred during the background copy, the second argument is the error string associated with the error. With a background copy, it is not necessary to put inchan or outchan into non-blocking mode; the fcopy command takes care of that automatically. However, it is nec- essary to enter the event loop by using the vwait command or by using Tk. You are not allowed to do other I/O operations with inchan or outchan during a background fcopy. If either inchan or outchan get closed while the copy is in progress, the current copy is stopped and the command callback is not made. If inchan is closed, then all data already queued for outchan is written out. Note that inchan can become readable during a background copy. You should turn off any fileevent handlers during a background copy so those handlers do not interfere with the copy. Any I/O attempted by a fileevent handler will get a "channel busy" error. Fcopy translates end-of-line sequences in inchan and outchan according to the -translation option for these channels. See the manual entry for fconfigure for details on the -translation option. The translations mean that the number of bytes read from inchan can be different than the number of bytes written to outchan. Only the number of bytes written to outchan is reported, either as the return value of a syn- chronous fcopy or as the argument to the callback for an asynchronous fcopy. EXAMPLE
This first example shows how the callback gets passed the number of bytes transferred. It also uses vwait to put the application into the event loop. Of course, this simplified example could be done without the command callback. proc Cleanup {in out bytes {error {}}} { global total set total $bytes close $in close $out if {[string length $error] != 0} { # error occurred during the copy } } set in [open $file1] set out [socket $server $port] fcopy $in $out -command [list Cleanup $in $out] vwait total The second example copies in chunks and tests for end of file in the command callback proc CopyMore {in out chunk bytes {error {}}} { global total done incr total $bytes if {([string length $error] != 0) || [eof $in] { set done $total close $in close $out } else { fcopy $in $out -command [list CopyMore $in $out $chunk] -size $chunk } } set in [open $file1] set out [socket $server $port] set chunk 1024 set total 0 fcopy $in $out -command [list CopyMore $in $out $chunk] -size $chunk vwait done SEE ALSO
eof(n), fblocked(n), fconfigure(n) KEYWORDS
blocking, channel, end of line, end of file, nonblocking, read, translation Tcl 8.0 fcopy(n)
All times are GMT -4. The time now is 10:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy