I have the following in script.tcl
:
#!/usr/bin/env tclsh
set disk(free) [exec -- stat -f -c 'scale=3;(%a*%S)/1024/1024/1024' / | bc ]
When I execute the script, I get the following output: (translated from Hungarian)
stat: missing operand
For more information execute the „stat --help” command.
while executing
"exec -- stat -f -c 'scale=3"
invoked from within
"set disk(free) [exec -- stat -f -c 'scale=3;(%a*%S)/1024/1024/1024' / | bc ]"
(file "~/script.tcl" line 2)
What am I doing wrong? Running the command on it's own works just fine.
You have to brace your expressions instead of single quotes.
% exec stat -f -c {scale=3;(%a*%S)/1024/1024/1024} / | bc
137.916
%