I wrote a tiny Bash script to find all Mercurial changes (starting from the tooltip) containing the string passed in the argument:
#!/bin/bash CNT=$(hg tip | awk '{ print $2 }' | head -c 3) while [ $CNT -gt 0 ] do echo rev $CNT hg log -v -r$CNT | grep $1 let CNT=CNT-1 done
If I interrupt it by pressing ctrl-c, the "hg log" command is most often executed, and this command is interrupted, but my script continues.
Then I thought about checking the return status of "hg log", but because I pass it to grep, I'm not too sure how to do this ...
How do I exit this script when it is interrupted? (By the way, I don’t know if this script is good for what I want to do, but it does the job, and in any case I am interested in the “interrupted” problem)
bash copy-paste interrupt
SyntaxT3rr0r
source share