Crontab 執行結果的換行字元 - BBS
By Skylar DavisLinda
at 2008-08-23T22:05
at 2008-08-23T22:05
Table of Contents
※ 引述《[email protected] (有若無,實若虛)》之銘言:
: ※ 引述《[email protected] (聽說)》之銘言:
: > 我使用 crontab 定時執行 ffmpeg 來作影像轉檔
: > 執行完以後 cron 會把執行的輸出寄到信箱裡
: > 不過可能 ffmpeg 在執行時會不斷更新進度訊息用到了 \r
: 『Crontab 執行結果的換行字元』這應該是跟 ffmpeg 或相關選項有關,
: 跟 crontab 無關啊
因為我覺得這跟 ffmpeg 的選項無關才沒提
這問題應該跟環境變數有關
我換一個問法好了
現在有一支程式, 跟 FreeBSD (光碟)開機時一樣會轉圈圈
# cat test.php
<?php
$chr = array("-", "\\", "|", "/");
for($i=0; $i<30; $i++)
{
foreach($chr as $c)
{
print $c."\r";
sleep(1);
}
}
user crontab in FreeBSD:
* * * * * /usr/local/bin/php ~/test.php
in Linux:
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
* * * * * /usr/bin/php ~/test.php
執行結果(有輸出會寄到 user mailbox)
FreeBSD:
-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|
^M/^M-^M\^M|^M/^M-^M\
+|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M
-^M\^M|^M/^M-^M\^M|^M
+/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M
\^M|^M/^M-^M\^M|^M/^M
+-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/
Linux:
-
\
|
/
-
\
|
/
-
\
|
/
-
\
|
/
(下略)
Linux 就是會自動把 \r 換成 \n (也不是換成 \r\n)
但 FreeBSD 不會換, 他就是保留 \r
可是我不知道有什麼變數是跟這有關
--
: ※ 引述《[email protected] (聽說)》之銘言:
: > 我使用 crontab 定時執行 ffmpeg 來作影像轉檔
: > 執行完以後 cron 會把執行的輸出寄到信箱裡
: > 不過可能 ffmpeg 在執行時會不斷更新進度訊息用到了 \r
: 『Crontab 執行結果的換行字元』這應該是跟 ffmpeg 或相關選項有關,
: 跟 crontab 無關啊
因為我覺得這跟 ffmpeg 的選項無關才沒提
這問題應該跟環境變數有關
我換一個問法好了
現在有一支程式, 跟 FreeBSD (光碟)開機時一樣會轉圈圈
# cat test.php
<?php
$chr = array("-", "\\", "|", "/");
for($i=0; $i<30; $i++)
{
foreach($chr as $c)
{
print $c."\r";
sleep(1);
}
}
user crontab in FreeBSD:
* * * * * /usr/local/bin/php ~/test.php
in Linux:
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
* * * * * /usr/bin/php ~/test.php
執行結果(有輸出會寄到 user mailbox)
FreeBSD:
-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|
^M/^M-^M\^M|^M/^M-^M\
+|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M
-^M\^M|^M/^M-^M\^M|^M
+/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M
\^M|^M/^M-^M\^M|^M/^M
+-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/^M-^M\^M|^M/
Linux:
-
\
|
/
-
\
|
/
-
\
|
/
-
\
|
/
(下略)
Linux 就是會自動把 \r 換成 \n (也不是換成 \r\n)
但 FreeBSD 不會換, 他就是保留 \r
可是我不知道有什麼變數是跟這有關
--
Tags:
BBS
All Comments
Related Posts
請問Broadcom 5715S 有解決嗎?
By Hamiltion
at 2008-08-23T17:49
at 2008-08-23T17:49
grep reg切出來的不重覆字串計數
By Megan
at 2008-08-23T00:04
at 2008-08-23T00:04
cyrus-sasl
By Genevieve
at 2008-08-22T18:59
at 2008-08-22T18:59
grep reg切出來的不重覆字串計數
By Kristin
at 2008-08-22T18:54
at 2008-08-22T18:54
grep reg切出來的不重覆字串計數
By Daniel
at 2008-08-22T17:25
at 2008-08-22T17:25