Linux에서 확인 질문을 만드는 방법은 무엇입니까?

Linux에서 확인 질문을 만드는 방법은 무엇입니까?

git push server-name나는 중대한 결과를 초래하는 특정 명령( )을 가지고 있습니다 . 확인을 요구하는 방법이 명령만? 공백을 무시해야 합니다.

확인은 다음과 같습니다.Enter 'yes i am sure.' to confirm:

그런데 확인이 필요하지 않은 또 다른 명령이 있습니다 git push server-name-staging.

답변1

git작성할 스크립트의 별칭 :

$ alias git=mygit

...당신 PATH어딘가에 살고 있으며 다음과 같습니다.

#!/bin/sh
if [ "$1" = "push" ]
then
    /bin/echo -n "Enter 'yes i am sure.' to confirm: "
    read answer
    if [ "$answer" != "yes i am sure." ]
    then
        echo So indecisive...
        exit 1
    fi
fi

git "$@"

관련 정보