当前位置: 动力学知识库 > 问答 > 编程问答 >

Bash scripted curl commands producing different results than manual runs

问题描述:

I have a text file of roughly 900 cURLs to run. They are pretty hairy, with tons of quotes, apostrophes and other special characters.

To run them I have been trying to create a bash script to loop through the list:

#!/bin/sh

OLDIFS=$IFS

IFS="&&&"

echo "getting started"

cat staging_curl_script|while read line

do

$line

done

echo "done"

Unfortunately I have had an unusual issue. commands that run fine in the command prompt are returning the "file name too long" error. I echoed out these commands from the script and compared them to the manually run command, and they are identical.

Any idea why I am seeing different results?

网友答案:

silly mistake here, needed bash -c "$line"

分享给朋友:
您可能感兴趣的文章:
随机阅读: