# Get a list of all possible show commands via bash

**URL:** <https://dmap-community.ductus.global/t/get-a-list-of-all-possible-show-commands-via-bash/2059>\
**Category:** Other Northbound Interfaces\
**Created:** [September 7, 2018, 9:20am UTC](https://dmap-community.ductus.global/t/get-a-list-of-all-possible-show-commands-via-bash/2059 "2018-09-07T09:20:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaka](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@jaka](https://dmap-community.ductus.global/u/jaka)\
**Post date:** [September 7, 2018, 9:20am UTC](https://dmap-community.ductus.global/t/get-a-list-of-all-possible-show-commands-via-bash/2059/1 "2018-09-07T09:20:40Z")

</div>

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`

What I’m doing wrong?  
Thanks

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [September 16, 2018, 5:28pm UTC](https://dmap-community.ductus.global/t/get-a-list-of-all-possible-show-commands-via-bash/2059/2 "2018-09-16T17:28:25Z")

</div>

Regarding “show ?”:

```auto
#!/bin/sh
cmd="show"
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
exit

```

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:

```bash
#!/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

```

---

<div class="post-metadata">

**Author:** ![jaka](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@jaka](https://dmap-community.ductus.global/u/jaka)\
**Post date:** [February 20, 2019, 1:27pm UTC](https://dmap-community.ductus.global/t/get-a-list-of-all-possible-show-commands-via-bash/2059/3 "2019-02-20T13:27:43Z")

</div>

I did a very quick test and had no luck.  
In the end i did it by hand.  
BR
