Q
常規bash命令
1
A
回答
0
的>
是一個shell運營商和應該是一個shell中運行。試試這個,它可能工作:
sh -c 'bash copy.txt > copy.log'
+0
嗨桑德蘭,我想是這樣,但沒有運氣。我沒有找到我的文件夾中的copy.log。 DEF測試= 「SH -c '的bash /home/srinath/Desktop/copy.txt> copy.log'」 test.execute()。謝謝 – srinath 2010-05-26 11:33:02
0
在bash你usally做
cat copy.txt > copy.log
除非你認爲copy.txt是一個shell腳本。 但我想沒有按照你給的擴展。
2
我假定你正在試圖複製文件copy.txt在同一個文件夾中copy.log。有幾種'純粹'的Groovy方法可以做到這一點,但是你可以在Linux上使用本地調用來做到這一點,如下所示。
例子: ['/bin/sh', '-c', 'cat copy.txt > copy.log'].execute().consumeProcessOutput(System.out, System.err)
Groovy的方式: new File('copy.log') << new File('copy.txt').text
相關問題
- 1. boot2docker bash命令行非常慢
- 2. Bash「cd」命令無法正常工作
- 3. Bash expr命令
- 4. unix bash命令
- 5. &bash命令後
- 6. bash -x命令
- 7. Windows命令行管串到常規
- 8. 解析非常規命令輸出
- 9. gradle這個:常規命令行 - grep的
- 10. Visual Studio命令提示符與常規命令提示符?
- 11. bash命令參數
- 12. Bash綁定命令
- 13. \!在Bash命令中
- 14. 運行bash命令
- 15. 編輯bash命令?
- 16. bash命令文件
- 17. bash for inline命令
- 18. bash命令錯誤
- 19. bash的alias命令
- 20. Linux Bash sed命令
- 21. bash命令擴展
- 22. Bash Centos7「which」命令
- 23. Linux Bash goto命令?
- 24. $「\ r」 - 命令在bash
- 25. 嵌入bash命令
- 26. bash命令XOR^anothercommand
- 27. bash命令可變
- 28. 系統命令bash
- 29. bash讀取命令
- 30. 由bash命令行
這可能會幫助很多,如果你是一個更具體一點什麼你正在嘗試做的,哪些是你所問上受審所以。 – xlson 2010-06-04 07:41:03