Last active
October 1, 2019 02:25
-
-
Save composite/e26aaa0b59715fda4515fbaa976432f1 to your computer and use it in GitHub Desktop.
A shell file for custom command of generated path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| declare TARGET_PATH=/path/to/some.thing | |
| if [ ! -z "$*" ]; then | |
| if [[ "$*" == '-'* ]]; then | |
| echo $TARGET_PATH | |
| exit | |
| fi | |
| declare CMD="$1" | |
| shift | |
| declare ARG="$*" | |
| if [[ $* == *'{}'* ]]; then | |
| "$CMD" ${ARG/\{\}/$TARGET_PATH} | |
| else | |
| "$CMD" $ARG "${TARGET_PATH}" | |
| fi | |
| exit | |
| fi | |
| echo 'USAGE:' | |
| echo "$0 [COMMAND]: custom command for TARGET_PATH" | |
| echo "example: $0 vi -R > vi -R [TARGET_PATH]" | |
| echo " $0 fgrep 'example' {} | wc > fgrep 'example' [TARGET_PATH] | wc" | |
| echo "$0 [-]: prints TARGET_PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment