Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use scripts/utils/print_args.sh instead of pyscripts/utils/print_args.py #5025

Merged
merged 2 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions egs2/TEMPLATE/asr1/asr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down Expand Up @@ -309,7 +309,7 @@ for dset in ${test_sets}; do
exit 1
fi
if [ "${dset}" = "${valid_set}" ]; then
log "Info: The valid_set ${valid_set} is included in the specified test_sets. Change to --eval_valid_set true and remove the ${valid_set} from the test_sets"
log "Info: The valid_set ${valid_set} is included in the test_sets. '--eval_valid_set true' is set and '${valid_set}' is removed from the test_sets"
eval_valid_set=true
elif contains "${dset}" "${_test_sets}"; then
log "Info: ${dset} is duplicated in the test_sets. One is removed"
Expand Down
49 changes: 49 additions & 0 deletions egs2/TEMPLATE/asr1/scripts/utils/print_args.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail

extra_chars=(
' '
';'
'&'
'|'
'<'
'>'
'~'
'`'
'"'
' '
'{'
'}'
'('
')'
)

new_args=""
for arg in "${@}"; do
if [[ ${arg} = *"'"* ]]; then
arg=$(echo "${arg}" | sed -e "s/'/'\\\\''/g")
fi

surround=false
if [[ ${arg} = *\** ]]; then
surround=true
elif [[ ${arg} = *\?* ]]; then
surround=true
elif [[ ${arg} = *\\* ]]; then
surround=true
else
for char in "${extra_chars[@]}"; do
if [[ ${arg} = *${char}* ]]; then
surround=true
break
fi
done
fi

if "${surround}"; then
new_args+="'${arg}' "
else
new_args+="${arg} "
fi
done
echo ${new_args}
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/diar1/diar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
1 change: 1 addition & 0 deletions egs2/TEMPLATE/diar1/scripts/utils/print_args.sh
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/enh1/enh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
1 change: 1 addition & 0 deletions egs2/TEMPLATE/enh1/scripts/utils/print_args.sh
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/enh_asr1/enh_asr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
1 change: 1 addition & 0 deletions egs2/TEMPLATE/enh_asr1/scripts/utils/print_args.sh
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/enh_diar1/enh_diar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
1 change: 1 addition & 0 deletions egs2/TEMPLATE/enh_diar1/scripts/utils/print_args.sh
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/enh_st1/enh_st.sh
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/mt1/mt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/slu1/slu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/ssl1/hubert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/st1/st.sh
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/svs1/svs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh


Expand Down
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/tts1/tts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down
1 change: 1 addition & 0 deletions egs2/TEMPLATE/uasr1/scripts/utils/print_args.sh
2 changes: 1 addition & 1 deletion egs2/TEMPLATE/uasr1/uasr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ EOF

log "$0 $*"
# Save command line args for logging (they will be lost after utils/parse_options.sh)
run_args=$(pyscripts/utils/print_args.py $0 "$@")
run_args=$(scripts/utils/print_args.sh $0 "$@")
. utils/parse_options.sh

if [ $# -ne 0 ]; then
Expand Down