Bear in mind that channels do not always start with #

if $left(<text/var/$n>,1) isin $chantypes { echo -a channel }
else echo -a not channel