Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell equivalent of Perl's die

Is there a shell equivalent (in either bash or zsh) of Perl's die function?

I want to set the exit code and print a message in a single line. I know I can make my own simple function but I'm kind of hoping for a built in.

like image 617
bahamat Avatar asked Oct 12 '25 03:10

bahamat


1 Answers

Nope, you need both echo and exit

like image 100
glenn jackman Avatar answered Oct 14 '25 20:10

glenn jackman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!