快速生成简单可运行的Bash脚本,满足文本处理和文件操作等基础自动化需求。
{"bashScript":"#!/bin/bash\n\n# 输入文件路径\ninput_file=\"input.txt\"\n# 输出文件路径\noutput_file=\"output.txt\"\n\n# 使用grep过滤不包含关键词'error'的行并保存到输出文件\ngrep -v 'error' \"$input_file\" > \"$output_file\"","executionInstructions":"1. 创建一个包含文本内容的文件,例如 'input.txt'。\n2. 将脚本内容保存到一个文件,例如 'remove_error_lines.sh'。\n3. 确保脚本具有可执行权限,通过命令 'chmod +x remove_error_lines.sh'。\n4. 运行脚本:'./remove_error_lines.sh'。\n5. 处理完成后,过滤后的内容会保存在 'output.txt' 文件中。\n6. 确保 'input.txt' 和脚本在同一目录,或者调整路径参数。"}
```json { "bashScript": "#!/bin/bash\n\n# Check if the user provided a directory as argument\nif [ $# -ne 1 ]; then\n echo \"Usage: $0 <directory_path>\"\n exit 1\nfi\n\n# Assigning the first argument to DIR variable\nDIR=$1\n\n# Check if the provided path is a valid directory\nif [ ! -d \"$DIR\" ]; then\n echo \"Error: $DIR is not a valid directory.\"\n exit 1\nfi\n\n# Loop through all files in the specified directory\nfor file in \"$DIR\"/*; do\n # Check if it is a file (not a directory)\n if [ -f \"$file\" ]; then\n # Extract the file name without extension\n baseName=\"$(basename -- \"$file\")\"\n # Rename the file with .log extension\n mv \"$file\" \"$DIR/${baseName%.*}.log\"\n fi\ndone\n\necho \"All files in $DIR have been renamed with the .log extension.\"", "executionInstructions": "This script renames all files in a specified directory by changing their extensions to '.log'.\n\nSteps to execute:\n1. Save the script to a file, e.g., `rename_to_log.sh`.\n2. Make the script executable: `chmod +x rename_to_log.sh`.\n3. Run the script with the directory path as an argument: `./rename_to_log.sh /path/to/directory`.\n\nNote:\n- Ensure you have write permissions in the target directory.\n- The script only processes files (and not subdirectories) within the specified directory.\n- It runs on Linux and does not handle spaces in file names. To handle spaces, additional modifications are needed." } ```
{"bashScript": "#!/bin/bash\n\n# Checking if the input Excel file is provided\nif [ \"$#\" -ne 1 ]; then\n echo \"Usage: $0 <input_excel_file.xlsx>\"\n exit 1\nfi\n\ninput_file=\"$1\"\noutput_file=\"output.json\"\n\n# Converting the first column of the Excel file to CSV using `in2csv` from csvkit\nin2csv \"$input_file\" | cut -d',' -f1 | sed 1d | jq -R . | jq -s . > \"$output_file\"\n\n# Notify user of success\necho \"JSON array has been saved to $output_file\"","executionInstructions":"1. 确保您已经安装了以下工具:\n - `in2csv` (来自 csvkit,安装方法:`pip install csvkit`)\n - `jq` (MacOS 上可通过 Homebrew 安装:`brew install jq`)\n2. 将脚本保存到一个文件,如 `excel_to_json.sh`。\n3. 授予脚本执行权限:`chmod +x excel_to_json.sh`\n4. 运行脚本并传入 Excel 文件路径作为参数,例如:`./excel_to_json.sh input_file.xlsx`\n5. 脚本会创建一个名为 `output.json` 的文件,其中包含第一列的数据以 JSON 数组的形式存储。"}
适合掌握基础编程但不熟悉Bash脚本的开发者,可以快速生成自动化脚本用以完成文本处理、文件操作等日常工作。
面向负责服务器维护的管理员,可快速创建批量文件操作和环境管理脚本,提升系统管理效率。
非技术背景的职场人,通过简单描述任务生成脚本,用于解决文件整理、数据批量处理等重复性操作。
对IT技术感兴趣的学习者,可以通过使用本工具生成代码,了解脚本逻辑、运行方式,提升学习效率。
需要节省时间的多领域独立工作者,快速解决无技术壁垒的自动化需求,提高生产力,同时节约外包成本。
帮助用户在短时间内生成简单、可运行的Bash脚本,解决文本处理和文件操作等基础自动化需求,从而提高用户的工作效率并降低对编程技术的依赖。
将模板生成的提示词复制粘贴到您常用的 Chat 应用(如 ChatGPT、Claude 等),即可直接对话使用,无需额外开发。适合个人快速体验和轻量使用场景。
把提示词模板转化为 API,您的程序可任意修改模板参数,通过接口直接调用,轻松实现自动化与批量处理。适合开发者集成与业务系统嵌入。
在 MCP client 中配置对应的 server 地址,让您的 AI 应用自动调用提示词模板。适合高级用户和团队协作,让提示词在不同 AI 工具间无缝衔接。
免费获取高级提示词-优惠即将到期