# linux-shell **Repository Path**: oraclegao/linux-shell ## Basic Information - **Project Name**: linux-shell - **Description**: linux 工具 shell 脚本 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2019-11-26 - **Last Updated**: 2023-03-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # linux-shell ## Examples - Shell Header ``` shell #!/usr/bin/env bash ``` - Shell Debug ``` shell set -ex ``` - Change to Current Shell Script Dir ``` shell cd ${0%/*} ``` - Parse Xml Elements ``` shell cat pom.xml | grep '' | head -n 1 | awk -F '>' '{print $2}' | awk -F '<' '{print $1}' ``` - Call github shell ``` curl -L github.com/OracleGao/linux-shell/raw/master/varsub.sh | bash -s -- Dockerfile.template Dockerfile ``` ### yaml转properties ``` shell HELP: translate yaml to properties 2020042602 Usage: yaml2props.sh [OPTIONS] yaml2props.sh -h | --help OPTIONS: -D, --debug debug mode, show debug message -h, --help show help and exit --key get value of the prop key if exists ``` ### yaml转envs ``` shell bash <(curl -L -s https://gitee.com/oraclegao/linux-shell/raw/master/yaml2envs.sh) -h ``` ``` txt HELP: translate yaml to system envionment variables 2020042602 Usage: yaml2envs.sh [OPTIONS] yaml2envs.sh -h | --help OPTIONS: -D, --debug debug mode, show debug message -h, --help show help and exit --key get value of the env key if exists ``` ### properties转envs ``` shell bash <(curl -L -s https://gitee.com/oraclegao/linux-shell/raw/master/prop2envs.sh) -h ``` ``` txt HELP: translate properites to system envionment variables 2020042701 Usage: prop2envs.sh [OPTIONS] prop2envs.sh -h | --help OPTIONS: -D, --debug debug mode, show debug message -h, --help show help and exit --key get value of the env key if exists ``` ### Split File ``` shell split --verbose -b 1000k ${filename} -d -a 2 ${filename}.f | awk -F "'" '{print $2}' > ${filename}.split ``` ### Join File ``` shell cat $(cat ${filename}.split) > ${filename} ``` - see [Split File](#Split-File) ## 创建私有CA根证书,并颁发服务端和客户端的ssl证书 ``` shell bash <(curl -L -s https://gitee.com/oraclegao/linux-shell/raw/master/ssl-gen.sh) ``` ## Refs - [curl方式执行shell脚本时传参数](https://sukbeta.github.io/curl-shell-args/)