what are the chances you actually need literal '%template' in cmd?
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
5675a08012
commit
ccad66749c
17
sx-open
17
sx-open
|
@ -107,7 +107,7 @@ error() {
|
||||||
handle_target() {
|
handle_target() {
|
||||||
declare -n result=$1
|
declare -n result=$1
|
||||||
declare h cmd regex target_is_file target target_left cmd_is_template
|
declare h cmd regex target_is_file target target_left cmd_is_template
|
||||||
target_is_file=0
|
cmd_append_target=1
|
||||||
target=$2
|
target=$2
|
||||||
target_left=$target
|
target_left=$target
|
||||||
|
|
||||||
|
@ -127,16 +127,13 @@ handle_target() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
cmd=( $1 ); regex=$2
|
cmd=$1 regex=$2
|
||||||
|
|
||||||
for c in "${!cmd[@]}"; do
|
if [[ $cmd == *'%target%'* ]]; then
|
||||||
if [[ "${cmd[c]}" == '%target%' ]]; then
|
cmd=( ${cmd//%target%/$target} )
|
||||||
cmd_is_template=1
|
else
|
||||||
cmd[c]="$target"
|
cmd+=( "$target" )
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
(( cmd_is_template )) || cmd+=( "$target" )
|
|
||||||
|
|
||||||
if [[ "$target_left" =~ $regex ]]; then
|
if [[ "$target_left" =~ $regex ]]; then
|
||||||
act "${cmd[@]}"; result=$?
|
act "${cmd[@]}"; result=$?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user