| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_readFileContent { |
| |
| local FILES="$1" |
| |
| |
| cli_checkFiles "$FILES" |
| |
| |
| case "$2" in |
| |
| '--first-line' ) |
| cat "$FILES" | head -n 1 |
| ;; |
| |
| '--last-line' ) |
| cat "$FILES" | tail -n 1 |
| ;; |
| |
| '--copyright' ) |
| |
| |
| |
| |
| local PATTERN='^Copyright (\(C\)|©) [0-9]+(-[0-9]+)? .+$' |
| if [[ $(cli_readFileContent "$FILES" '--first-line') =~ "${PATTERN}" ]];then |
| cli_readFileContent "$FILES" '--first-line' |
| fi |
| ;; |
| |
| '--all-lines' | * ) |
| cat "$FILES" |
| esac |
| |
| } |