I’m trying to write a script that would collect all “possible completions” throughout whole show command tree. When i connect via SSH i can manualy do “show ?” or “show alarm ?” etc… When I try this script locally: #!/bin/sh { confd_cli <<EOF show ? EOF }
I get a response : show syntax error: element does not exist
Regarding “all possible completions”, if you can use bash instead of sh (2nd row from the bottom is not supported by sh) you can try something like this:
#!/bin/bash
rm -f tmp.txt
cmd="show parser dump show | save tmp.txt"
confd_cli <<EOF
$cmd
exit
EOF
sed -e 's/<[^>]*>//g' tmp.txt > tmp2.txt
while read cmd; do
cmd="${cmd} ?"
len=${#cmd}
ch='\b'
undo="$(printf '%*s' $len | tr ' ' "$ch")"
confd_cli -n <<EOF | sed -e '2d' -e '$d'
$cmd${undo}exit
EOF
done < <(cat tmp2.txt)
exit