Create file if not exist with bash
If you need your bash script to create file if it doesn`t exist:
[[ -f /path/filename ]] || touch /path/filename
If you need your bash script to create file if it doesn`t exist:
[[ -f /path/filename ]] || touch /path/filename
#!/bin/sh clients=`arp -a | grep -v 10.254.0.1 | grep 10.254.0. | awk '{print ($2)}' | tr -d \)\(` #echo $clients for i in $clients do if ping -c 1 -t 1 $i | grep "0 packets received"; then arp -d $i # echo "not ok" else # echo "ok" fi done