Script showing bad interpreter and will not run

前端 未结 4 1651
星月不相逢
星月不相逢 2021-01-21 10:03

I was sent a perl script over mail and asked to run it .I placed it on my local drive as is but when I tried to run the script it shows me

/usr/bin/perl^M: bad          


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 10:42

    You're on the right track. Your script has DOS style newlines at the end, which is not supported by your kernel.

    The solution is to use something to convert the DOS newlines to Unix style. dos2unix would presumably work if you had it, so use something else equivalent.

提交回复
热议问题