I'm trying to write a bash script that detects/check if tun/tap has been enabled and if so, it'll do 'stuff'. I'm having issues getting this to work properly. William helped me out a bit on IRC, but I still can't get it to work.
Here's what I have so far, it's pretty basic:
#!/bin/bash arg=$(ls /dev/net/tun >>/dev/null; echo $?) if [ "$arg" == "2" ] then echo it's not there else echo it's there fi
The idea is that if 'ls /dev/....' exists with code 2, it means tun/tap is disabled and if it exits with 0 it means it's enabled.
If I run this in a bash script, it doesn't seem to be outputting the 2 anymore, nor doing the else.... I can't see what's wrong...
Thanks