2011-11-18 6 views
2

나는 꽤 자주 같은 몇 가지 매우 긴 콘솔 명령이 있습니다Linux에서 긴 콘솔 명령에 대한 바로 가기를 만들 수 있습니까?

python /var/www/closure-library/closure/bin/calcdeps.py \ 
-i myJSFile.js \ 
-p ../closure-library/closure/goog/ \ 
-o compiled \ 
-c /var/www//closure-compiler/build/compiler.jar \ 
-f "--compilation_level=ADVANCED_OPTIMIZATIONS" \ 
-f "--define=goog.LOCALE='de'" > myOutputFile.js 

을 나는 단순히 사용하고 싶습니다 :에 simmilar

closure -i myJSFile.js -o myOutputFile.js 

또는 무언가를. 어떻게해야합니까?

답변

9

쉘의 맨 페이지에서 aliases을 찾아보십시오.

아마도 같은 :

alias closure='python /var/www/closure-library/closure/bin/calcdeps.py -p ../closure-library/closure/goog/ -c /var/www//closure-compiler/build/compiler.jar -f "--compilation_level=ADVANCED_OPTIMIZATIONS" -o compiled' 

그런 다음 당신은 당신이 스크립트를 너무 작성하고 -o myOutputFile.js 옵션을 처리 할 수 ​​

$ closure -i myJSFile.js > myOutputFile.js 
+4

참고 할 수있다. – Sorpigal

2

할 수 있습니다.

#!/bin/bash 
if [ $# -ne 2 ]; then 
    echo "Usage: closure InputFile OutputFile" 
    exit 1 
fi 

python /var/www/closure-library/closure/bin/calcdeps.py \ 
-i "$1" \ 
-p ../closure-library/closure/goog/ \ 
-o compiled \ 
-c /var/www//closure-compiler/build/compiler.jar \ 
-f "--compilation_level=ADVANCED_OPTIMIZATIONS" \ 
-f "--define=goog.LOCALE='de'" > "$2" 

그리고 당신은 당신이 당신의`.bashrc` 또는 다른 시작 파일에이를 작성해야합니다, 그래서 별명이 세션 사이에 잊혀 closure myJSFile.js myOutputFile.js

관련 문제