0

私は次のものを持っていますscript.tcl

#!/usr/bin/env tclsh
set disk(free) [exec -- stat -f -c 'scale=3;(%a*%S)/1024/1024/1024' / | bc ]

スクリプトを実行すると、次の出力が得られます: (ハンガリー語からの翻訳)

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)

私は何を間違っていますか?コマンドを単独で実行すると、問題なく動作します。

4

1 に答える 1

3

一重引用符の代わりに式を括弧で囲む必要があります。

% exec stat -f -c {scale=3;(%a*%S)/1024/1024/1024} / | bc
137.916
%  
于 2015-10-23T10:04:32.250 に答える