【发布时间】:2015-02-20 04:17:14
【问题描述】:
我在 Python 中调用这个命令:
os.system('echo %s > `find $HOME -iname p410.yaml`' % string)
这在 OSX 上运行良好,但在 Ubuntu 上给我/home/path/to/p410.yaml: Directory nonexistent。但是,我可以使用 vim 在它给我的路径上编辑文件。
知道怎么了?
编辑
stat find $HOME -iname p410.yaml的输出
File: `/home/aslab/chris_ws/src/pulseon_p400/config/p410.yaml'
Size: 124 Blocks: 8 IO Block: 4096 regular file
Device: 805h/2053d Inode: 460669 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1001/ aslab) Gid: ( 1001/ aslab)
Access: 2014-12-22 13:45:57.000000000 +1000
Modify: 2014-12-22 13:44:45.000000000 +1000
Change: 2014-12-22 13:44:45.000000000 +1000
Birth: -
File: `/home/aslab/uwb_ws/src/pulseon_p400/launch/p410.yaml'
Size: 163 Blocks: 8 IO Block: 4096 regular file
Device: 805h/2053d Inode: 457183 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1001/ aslab) Gid: ( 1001/ aslab)
Access: 2014-12-19 08:11:30.000000000 +1000
Modify: 2014-09-12 14:37:19.000000000 +1000
Change: 2014-09-12 14:37:19.000000000 +1000
Birth: -
【问题讨论】:
-
你为什么使用
sudo? -
这只是试图让它工作,它真的无关紧要。生病删除它以避免混淆
-
如果直接在shell中运行
find $HOME -iname p410.yaml会发生什么? -
它返回给我它的路径。它让我去 vim
find ... p410.yam很好 -
如果你运行
stat `find $HOME -iname p410.yaml`会怎样?