plist
head
電話をかけてコマンドを発行する機能がありますtail
。しかし、その領域を処理するために別の関数を呼び出しましたpregion
。
# --- plist ---
("-H"|"--head")
local -r hn="$2" ; shift 2 ;;
("-T"|"--tail")
local -r tm="$2" ; shift 2 ;;
("--FS") # field separator
local fs="$2" ; shift 2 ;;
("--incl")
local incl+=("$2") ; shift 2 ;; # file type suffix
("--excl")
local excl+=("$2") ; shift 2 ;; # file type suffix
("--RP")
local pn=$2 ; shift 2 ;;
("--RQ")
local qn=$2 ; shift 2 ;;
("--dyn"|"--dynamic")
local dyn="1" ; shift 1 ;;
("-C"|"--context")
local ctx=$2 ; shift 2 ;;
("-d"|"--directory")
local fdir=$2 ; shift 2 ;;
(--)
shift; break ;;
...
if [[ -v hn ]]; then
head -v -hn "$n"
elif [[ -v tm ]]; then
tail -v -n "$tm"
elif [[ -v dyn ]]; then
pregion "$@" # requires original options here
fi
Forhead
と私は 'とtail
'オプションを使います。 optionsを処理するときに使用しているため、単にに渡すことはできないため、元の入力パラメータのコピーが必要です。-H
-T
--FS
--incl
shift
plist
"$@"
pregion
これは電話head
するかtail
plist -H 8 ./01cuneus
plist -T 13 ./01cuneus
通貨の例pregion
plist --dyn -C 8 "Martin" ./01cuneus
plist --incl .texi --incl .org --RP 8 --RQ 13 ./01cuneus
plist --incl .texi --incl .org --dyn -C 8 "Martin" ./01cuneus
ベストアンサー1
元のパラメータを配列にコピーしてそれをpregion
。
plist() {
local -a origargs=("$@")
...
case
...
esac
...
if
...
elif [[ -v dyn ]]; then
pregion "${origargs[@]}"
fi