Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将我的代码从perl转换为shell脚本_Shell_Perl - Fatal编程技术网

将我的代码从perl转换为shell脚本

将我的代码从perl转换为shell脚本,shell,perl,Shell,Perl,请帮我解决这个问题。我有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 -

请帮我解决这个问题。我有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
}

完全未经测试,而且是逐行翻译(这里没有优化,尽管有些东西可能写得更好):


你试过什么?你有什么问题?请出示您的密码。
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