hello I have a command
echo $(ssh dema@10.0.1.100 'zfs list -o name -t snapshot | grep tank/dema@Daily_$(date +"%Y-%m-%d") | wc -l')
this returns a integer value I need to while loop over it but can't seem to figure out who to do that.
while echo $(ssh dema@10.0.1.100 'zfs list -o name -t snapshot | grep tank/dema@Daily_$(date +"%Y-%m-%d") | wc -l') -g 1; do
echo stuff
done
Hi You can try like this,
declare -i value
value=`echo $(ssh dema@10.0.1.100 'zfs list -o name -t snapshot | grep tank/dema@Daily_$(date +"%Y-%m-%d") | wc -l')`
while [ "$value" -gt 1 ]; do
echo stuff
value=`echo $(ssh dema@10.0.1.100 'zfs list -o name -t snapshot | grep tank/dema@Daily_$(date +"%Y-%m-%d") | wc -l')`
done
OR we can use it like,
declare -i value
while : ; do
value=`echo $(ssh dema@10.0.1.100 'zfs list -o name -t snapshot | grep tank/dema@Daily_$(date +"%Y-%m-%d") | wc -l')`
[[ "$value" -gt 1 ]] || break
echo stuff
done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.