Check if a bridge is broken using the terminal

I wouldn’t want to clutter up my torrc with broken bridges, so I’m looking for a way to check them before adding them. Is there any way? I use GNU/Linux, so a way using the terminal would be preferable.

Thank you.

What do you mean by ‘broken’?

If you want to test if obfs4 is functional, then this shell script can help you:

bridges="49EF0BBC31E7DD0607BED3A8BB80368808FE64AA 9AF33A657BF8BD7D1531E05C66B1FF9EE41437BE"

for fp in $bridges
    do torsocks curl http://yq5jjvr7drkjrelzhut7kgclfuro65jjlivyzfmxiq2kyv5lickrl4qd.onion/status?id=$fp

One that cannot be connected to because it is broken or blocked in the country I am in.

I’ve noticed that bridges usually have a short lifetime. I wouldn’t consider them broken, just no longer available. I believe this is really a good thing in as much as the longer a bridge persists, the greater the chance of it being detected.

Now back to “last’s” question, which is how to find out if a bridge is still available or not. The way I do it is somewhat tedious:

  1. Using an editor such as nano comment out all of the bridges in the torrc file except the first one.

  2. Fire up tor-browser and see if it gets through. shut down tor-browser.

  3. If tor-browser gets through, comment out the first entry and uncomment the next bridge entry.
    If it doesn’t get through, delete the entry and uncomment the next bridge entry.

  4. repeat ad-nauseum.(until you have tried them all or you are sick of doing it.)

Is there an easier way?