Yamamoto Tsunetomo said this quote

All of us want to live, and that is absolutely natural. However, we should learn from childhood on to choose our best way to die. If we don't do that, we end up spending our days like a dog, only in search of harbour, food and expressing a blind loyalty to his owner in return. That isn't enough to make our lives have a meaning.