use this command:
to know the return value of a native program in Linux.
try it yourself:
echo $? #(watch the result, it will be 1, which means unsuccess)
echo "hello world" > file
echo $? #(watch the result, it will be 0, means success)