[완료] 모든 shell에서 사용가능한 alias 만드는 법.

dl3zp3의 이미지

bash, fish, zsh등 거의 모든 shell에서 사용가능한 alias를 한번에 만드는 방법이 존재하나요?

일단 간단하게 명령이름만 줄이는 경우, 예를 들어

$ very_very_long_command -r -s -t file1 file2

$ vvlc -r -s -t file1 file2

로 줄여서 쓰고 싶으면 ~/bin에 sybolic link를 만들어주면 됩니다.

$ ln -s `which very_very_long_command` ~/bin/vvlc

하지만 옵션도 같이 넣어서 줄여주고 싶으면?? 예를 들어 ls -l을 ll로 줄여쓰기 위해서 ~/bin에 이름이 ll인 bash스크립트를 만들어보았습니다.

$ cd ~/bin
$ touch ll
$ chmod u+x ll

ll스크립트에 다음의 코드를 입력합니다.

#!/bin/bash
ls -l $@

이렇게 하면 다음과 같은 문제가 있습니다.

$ mkdir ~/test && cd ~/test
$ touch 'hello world'
$ ls -l hello\ world 
-rw-r--r-- 1 fj fj 0 2009-03-09 20:51 hello world
$ ll hello\ world 
ls: cannot access hello: No such file or directory
ls: cannot access world: No such file or directory

방법은 없는 걸까요...

cinsk의 이미지