hello,
I want to find out how much free disk space is present for a particular
directory in unix system.
For this I'm executing command :
p=r.getRuntime().exec("rsh "+machine[i]+" \"cd /scratch; df -k .\" |
awk '{print $3}' ");
but, the '-' sign of df -k and the single quotes for print do not get
exceuted and hence I'm not able to get a proper o/p.
can anyone tell me how to execute it?
Gordon Beaton - 27 Dec 2006 13:37 GMT
> For this I'm executing command :
> p=r.getRuntime().exec("rsh "+machine[i]+" \"cd /scratch; df -k .\" |
[quoted text clipped - 4 lines]
>
> can anyone tell me how to execute it?
Try it like this instead, using an array to group the command
arguments properly:
String[] cmd = { "rsh",
machine[i],
"cd /scratch; df -k . | awk '{print $3}'"
};
p = r.getRuntime.exec(cmd);
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
ruds - 29 Dec 2006 05:27 GMT