在windows 系统上 写了个perl脚本来给 android 手机做压力测试。但是放到linux 系统上work 起来不是很友好。
该脚本放到 ubuntu 1204 64bit 系统上执行时会报如下错误:
$ ./adb_script.pl
bash: ./adb_script.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
然后对该脚本用 dos2unix 进行格式转化,
$ dos2unix ./adb_script.pl
The program 'dos2unix' is currently not installed. To run 'dos2unix' please ask your administrator to install the package 'dos2unix'
发现 ubuntu 默认未安装 dos2unix
$ sudo apt-get install dos2unix
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
dos2unix
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 60.1 kB of archives.
After this operation, 246 kB of additional disk space will be used.
Get:1 http://mirrors.163.com/ubuntu/ precise/universe dos2unix amd64 5.3.1-1 [60.1 kB]
Fetched 60.1 kB in 0s (2,893 kB/s)
Selecting previously unselected package dos2unix.
(Reading database ... 207091 files and directories currently installed.)
Unpacking dos2unix (from .../dos2unix_5.3.1-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up dos2unix (5.3.1-1) ...
安装完 dos2unix 后,重新执行
$ dos2unix ./adb_script.pl
dos2unix: converting file ./adb_script.pl to Unix format ...
然后再执行脚本文件,脚本完美的在ubuntu上执行。
$ ./adb_script.pl
adb_device_check start...