相关疑难解决方法(0)

以便携式方式获取shell中的文件大小(以字节为单位)?

在Linux上,我使用stat --format="%s" FILE,但我有权访问的Solaris没有stat命令.那我应该怎么用?

我正在编写Bash脚本,无法在系统上安装任何新软件.

我考虑过已经使用过:

perl -e '@x=stat(shift);print $x[7]' FILE
Run Code Online (Sandbox Code Playgroud)

甚至:

ls -nl FILE | awk '{print $5}'
Run Code Online (Sandbox Code Playgroud)

但这些看起来都不合理 - 运行Perl只是为了获得文件大小?或者运行2个命令来做同样的事情?

linux bash shell solaris

109
推荐指数
8
解决办法
15万
查看次数

linux shell文件大小

我想把文件的大小变成变量?怎么做?

ls -l | grep testing.txt | cut -f6 -d' '
Run Code Online (Sandbox Code Playgroud)

给出了大小但是如何将它存储在shell变量中?

linux shell

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

linux ×2

shell ×2

bash ×1

solaris ×1