2012-07-10 5 views
0

fish 쉘에서 현재 구성된 편집기를 어떻게 시작할 수 있습니까? 편집자는 $EDITOR입니다.

파이프 라인에서 입력을 받아 $EDITOR으로 식별되는 편집기에서 열리는 함수는 어떻게 생겼을까요?

인수 목록에서 $EDITOR에 경로를 여는 함수는 어떻게 생깁니 까?

답변

1

어떻게 같은 약 :

function edit -d "Open a file using $EDITOR" 
    for file in $argv 
     if test -e $file 
      eval $EDITOR $file 
      echo "Opening file $file" 
     else 
      echo "Create file? (y/n)" 
      read createFile 
      if test $createFile = "y" 
       eval $EDITOR -n $file 
       echo "Creating file $file" 
      end 
     end 
    end 
end