搜索

PythonReactSEOPDF
GitHub Skill

bash-scripting

Instructions in case if any bash (or any shell in general) script is needed.

stopsopa☆ 1 仓库 Stars3 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

When determining where script is if needed, always use

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if refering something from ROOT directory is needed then define ROOT based on DIR in relative manner from current script like:

ROOT="${DIR}/.."

or

ROOT="${DIR}/../.."

... depends how many directories up we have to go

Don't use shebang at the top of the file.

Call script like this:

/bin/bash ${DIR}/script.sh

When using variables always surround them with ${}.

never $DIR, always ${DIR}

error handling

Before exit with non zero exit code from script in case of error always print the message what's happened like so:

echo "${0} error: [and then message here]"

this way we will spit out information about origin of the error - when it comes to which script is it.

Add to the message any relevent parameters values like so

"name of env var MY_ENV_VAR=>${MY_ENV_VAR}<"

(surround with ><, this way I will see any whitespaces at the beginning or end of the value)

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!