AGENT SKILL

cli-file-writing

How to write multi-line text files using command line interfaces.

适用职业内容创作者
使用场景写作与文案
License 许可
MIT
最近更新
2026-10-02
Stars
★ 93
Forks
8

01 前言 Front Matter

name
cli-file-writing
description
How to write multi-line text files using command line interfaces.

03 SKILL.md 正文

CLI File Writing

When creating files with specific formatting or multiple lines in a command-line environment, it is best to use tools that preserve line breaks and exact structure.

Using the write_file Tool

If your agent environment supports a direct write_file API, use it by providing the exact path and the complete text content, making sure to include necessary newline characters (\n).

Alternative Shell Commands

If no direct API is available, you can use cat with a Heredoc to write multi-line strings:

cat << 'EOF' > /path/to/file.txt
Line 1
Line 2
EOF

04 同仓库更多 Skills