変数の内容に応じてパイプコマンドをどのように拡張できますか?

変数の内容に応じてパイプコマンドをどのように拡張できますか?

延長したいこの行は、オーディオストリームを録音するために/ usr / bin / mplayerを呼び出します。

参照スクリプトは並列record.shに複数回呼び出すことができ、どのコンテキストでエラーがエラーファイルに書き込まれるかを知る必要があります。

"$file"だから私の質問は:変数の内容が各行の先頭にも印刷されるようにこの行をどのように変更できますか?

"$mplayer" $playlist $url $mplayerflags -msglevel all=2 -dumpstream -dumpfile "$file"  >/dev/null 2>>"$errors" <&2 &

例: 代わりに:

some arbitrary error message0
some arbitrary error message1
some arbitrary error message2

some arbitrary error message3
some arbitrary error message4
some arbitrary error message5

したい:

/home/homedir/recordings/filelocation1.mp3 some arbitrary error message0
/home/homedir/recordings/filelocation1.mp3 some arbitrary error message1
/home/homedir/recordings/filelocation1.mp3 some arbitrary error message2

/home/homedir/recordings/filelocation1.mp3 some arbitrary error message3
/home/homedir/recordings/filelocation1.mp3 some arbitrary error message4
/home/homedir/recordings/filelocation1.mp3 some arbitrary error message5

ベストアンサー1

行を変更してこれを行うことはできません。単にmplayerを呼び出す前に、改行なしでファイル名を印刷するだけです。

おすすめ記事