#!/usr/bin/perl use 5.12.0; use strict; use warnings; # Find modem ID my $modem; my $list = `mmcli -L`; if ($list =~ m{/Modem/(\d+)}i) { $modem = $1; } else { die "didn't find modem id"; } my $chk = `mmcli -m $modem --messaging-list-sms`; my @lines = split(/\n/, $chk); if ($chk !~ /no sms messages were found/i) { say "Notice: mmcli shows there are pending SMS messages:"; say $chk; }