Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0099855

Browse files
committed
test.sh: apply fix, echo is not portable
1 parent78af3fc commit0099855

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎test.sh‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,20 +468,20 @@ expect="\
468468
"
469469

470470
c=1
471-
echo"$regex"| tr'\n'|whileread re;do
472-
inp=$(echo"$input"| awk -v c=$c'BEGIN{ RS = "" ; FS = "\n" }{print $c}')
473-
exp=$(echo"$expect"| awk -v c=$c'BEGIN{ RS = "" ; FS = "\n" }{print $c}')
471+
printf'%s\n'"$regex"|whileread re;do
472+
inp=$(printf'%s\n'"$input"| awk -v c=$c'BEGIN{ RS = "" ; FS = "\n" }{print $c}')
473+
exp=$(printf'%s\n'"$expect"| awk -v c=$c'BEGIN{ RS = "" ; FS = "\n" }{print $c}')
474474
var=$(./a.out"$re""$inp")
475475
if ["$1" ];then
476-
echo"$var"
476+
printf'%s\n'"$var"
477477
fi
478-
var1=$(echo"$var"| tail -1)
478+
var1=$(printf'%s\n'"$var"| tail -1)
479479
if [!"$exp"="$var1" ];then
480-
echo"fail test$c regex:$re input:$inp expect:$exp output:$var1"
480+
printf'%s\'"fail test$c regex:$re input:$inp expect:$exp output:$var1"
481481
exit 1
482482
fi
483-
time=$(echo"$var"| tail -2| head -n1)
484-
echo"pass test$c regex:$re input:$inp expect:$exp output:$var1$time"
483+
time=$(printf'%s\n'"$var"| tail -2| head -n1)
484+
printf'%s\n'"pass test$c regex:$re input:$inp expect:$exp output:$var1$time"
485485
c=$((c+1))
486486
done
487487

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp