请帮助我。我在Perl中有代码,这些代码是在Shell脚本中转换的。
#!perl
my @a = (1..7000);
for(@a){
my $curl=`curl -X GET http://localhost:9333/dir/assign?collection=chetan`;
print $curl;
$sub_string1 = substr($curl, 8,15);
print $sub_string1;
$t='curl -X PUT -F file=@/home/user/test.txt http://172.17.0.4:8080/'.$sub_string1;
print $t;
my $curl=`$t`;
#sleep(3)
# print $curl
}
答案 0 :(得分:-1)
未经测试,实际上是逐行翻译的(这里没有优化,即使有些东西可能写得更好):
for n in {1..7000}; do
curl="$(curl -X GET http://localhost:9333/dir/assign?collection=chetan)"
sub_string1="${curl:8:23}"
t="curl -X PUT -F file=@/home/user/test.txt http://172.17.0.4:8080/$sub_string1";
echo $t
curl="$($t)"
done