이 줄을 재사용하는 올바른 방법은 무엇입니까?

이 줄을 재사용하는 올바른 방법은 무엇입니까?

나는 최근에 다음과 같은 인용문을 생각해 냈습니다.

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 플레이어가 있기 때문에 필요합니다. 이것이 이름을 추적하기 위해 적절한 무작위 분포를 제공하는 (약 한 시간 동안 시도한 끝에) 찾을 수 있는 유일한 방법입니다. (처음에는 이것을 사용했지만 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기다리는 것도 마찬가지다.

몇 가지 다른 점: 두 숫자( )를 255와 cut -c1-2비교하는 이유는 무엇입니까? 숫자는 항상 100보다 작습니다. 왜 쓰나요 $1 - $1 + (1/3)*$1? 이것은 단지 ($1)/3입니다.

관련 정보