この行を再利用する正しい方法は何ですか?

この行を再利用する正しい方法は何ですか?

私は最近、次のような引用を思いついた。

for f in *.mp3; do sha1sum $f | sed -r 's/[a-z]//g' | cut -c1-2 | awk '{ print ($1 >= 255) ? $1 - $1 + (1/3)*$1 : $1 }' | xargs -i id3v2 -T {} $f; done

シャッフル機能のないMP3プレーヤーがあるので必要です。これは、名前を追跡するために適切なランダム分布を提供する(約1時間試みた最後に)見つけることができる唯一の方法です。 (最初はこれを使用しましたが、jotプログラムはランダムな結果に似た結果を生成するのに十分な頻度でランダムシードを更新しませんでした。

私はそれをエイリアスとして保存しようとし、次のようになりました。

awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:           ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                   ^ syntax error
awk: cmd. line:1: { print ( >= 255) ?  -  + (1/3)* :  }
awk: cmd. line:1:                                  ^ syntax error

これを私の.bashrc

私はそれをファイルに書き込むことができ、shebangを使ってchmod +x私のファイルに書き込むことができることを知っていますが、可能であればmyを使用することを好みます。$path.bashrc

ベストアンサー1

本当に自分のファイルに入れたくない場合は、bashを使用する必要があります。機能、一つでもないニックネーム

エイリアスをどのように定義しましたか?alias bla="for f in *.mp3....あなたが書いたものと同じものを書いた場合*、エスケープしないとおそらく空になります。なぜなら、bashが実行されるのではなく、評価されると解釈されるからです。$f待つのも同じだ。

いくつかの他の点:2つの数字()を255とcut -c1-2比較するのはなぜですか?数字は常に100未満です。なぜ書くのですか$1 - $1 + (1/3)*$1?これはただ($1)/3です。

おすすめ記事