Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
9/26/2006 6:57:36 AM EDT
and yes its posted in the techie area too...

im checking to see if a file has more than 0 bytes and if so FTP it over to the production box. ive got
<snip>
filesize= du -b file_to_process.rst
if [ filesize <= 0 ]; then
ftp (snip)
fi
<snip>

well the problem is the value in $filesize. i want a number to compare to zero. but the du command (and wc ) output for example:
# 123         .file_to_process.rst


anyone know of any command to give me just the number without the file name?
or any other ideas?
9/26/2006 7:01:53 AM EDT
[#1]
| cut -f1

eta: assuming no # sign on du output.
9/26/2006 7:02:08 AM EDT
[#2]

Quoted:
and yes its posted in the techie area too...

im checking to see if a file has more than 0 bytes and if so FTP it over to the production box. ive got
<snip>
filesize= du -b file_to_process.rst
if [ filesize <= 0 ]; then
ftp (snip)
fi
<snip>

well the problem is the value in $filesize. i want a number to compare to zero. but the du command (and wc ) output for example:
# 123         .file_to_process.rst


anyone know of any command to give me just the number without the file name?
or any other ideas?


filesize= du -b file_to_process.rst | cut -f2 -d" "

ETA: Oops, filesize you said
ETA2: Now its working
9/26/2006 7:05:56 AM EDT
[#3]
yup that did it
thanks guys



i love arfcom...
9/26/2006 7:19:11 AM EDT
[#4]
Or you can always use your friend awk ......

| awk '{print $1}'



Love unix..

Doc
9/26/2006 7:35:10 AM EDT
[#5]

Quoted:
Or you can always use your friend awk ......

| awk '{print $1}'



Love unix..

Doc


doh...
why didnt i think of that..
i just finished workin on an awk script to make the file im sending with this script....
oh well...