Tag Info

New answers tagged


I don't found better way that parse gcom command result. ## Search for a working USB port (/dev/ttyUSB) work=false for port in /dev/ttyUSB* do [[ -e $port ]] || continue gcom -d $port info &> /tmp/testusb testUSB=`cat /tmp/testusb | grep "Error\|Can't"` if [ -z "$testUSB" ]; then work=$port break fi done rm -rf ...


In the purest form, you can use pkill server1 That assumes server1 is actually the process name, not just somewhere in the command line - otherwise add an -f. pkill -f server1CommandArgument But wait! You can test what pkill will match and kill with the command pgrep - which is technically almost the same. The difference it: instead of killing, it ...


You have to indicate what to kill: kill -9 $(ps | grep "server1" | grep -v grep | awk '{ print $1 }') You can also use the trick: kill -9 $(ps | grep "server[1]" | awk '{ print $1 }')

Top 50 recent answers are included