Append && echo "success" to all commands

I am learning to build from SVN and other tools, with a lot of copying and pasting from forums. I like to append && echo "success" to all commands so that I can see at a glance if things went all right. Is there a way that I can have the bash shell append this to all commands?

Thanks!

that would be naff and possibly dangerous
what if you had the following?

cat file |
sort |
uniq -c|
head

you could set -o errexit and it would exit at the first error.
or

trap "echo ERROR:" ERR

Thanks, I learned a new word!

I do not understand what would be dangerous, but I take your word for it. I will google on the terms that you mention and hopefully that will teach me enough to understand.

Thanks.

naff?
sorry, british slang!

well, yes, as a professional korn shell scripter of old it would be very bad style
to do what you describe.

if one of my trainees did that I'd make them stand out in the playground!
:wink:

That's all right, the British are second only to the French in language pride! Spread your slang far! (Actually my nation was once a British colony, but these days it's mostly American slang spoken here)

I spent almost an hour with the daughter in the playground yesterday, so I have paid my dues! Tell me, is it also dangerous to append the lines myself, or just to have the shell do it for me automatically? I still cannot find any good info, so if you could RTFM me with a link, I would very much appreciate it.

Thanks!

no I just think it's an ugly way to do it.
it's a personal style thing.
it's better to flag an error than success.

i would use set -o errexit or trap ERR.
the usual unix way is to succeed quietly, but fail noisily.

what if the script already has an &&?
but if you really must
this will do it and give you a .bak backup

perl -pi.bak -e 's/$/ \&\& echo success'  your_file ...