# How to get the confd\_cli prompt?

**URL:** <https://dmap-community.ductus.global/t/how-to-get-the-confd-cli-prompt/914>\
**Category:** Other Northbound Interfaces\
**Created:** [January 3, 2017, 2:08am UTC](https://dmap-community.ductus.global/t/how-to-get-the-confd-cli-prompt/914 "2017-01-03T02:08:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harry\_Huang](https://avatars.discourse-cdn.com/v4/letter/h/a88e57/32.png) [@Harry\_Huang](https://dmap-community.ductus.global/u/Harry_Huang)\
**Post date:** [January 3, 2017, 2:08am UTC](https://dmap-community.ductus.global/t/how-to-get-the-confd-cli-prompt/914/1 "2017-01-03T02:08:59Z")

</div>

Hi,

I want to get confd\_cli prompt:

Example:  
sim\_1rp-ssr1# show isis

The part before ‘#’ in above command.

Is there any confd\_maapi can do that?

---

<div class="post-metadata">

**Author:** ![waitai](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/waitai/32/436_2.png) [@waitai](https://dmap-community.ductus.global/u/waitai)\
**Post date:** [January 3, 2017, 7:09pm UTC](https://dmap-community.ductus.global/t/how-to-get-the-confd-cli-prompt/914/2 "2017-01-03T19:09:05Z")

</div>

Refer to the man page for confd.conf on the following configurable parameters that can be used to configure the confd\_cli prompt:

```
/confdConfig/cli/prompt1 (xs:string) [\u@\h>]
  Prompt used in operational mode.

/confdConfig/cli/prompt2 (xs:string) [\u@\h%]
  Prompt used in configuration mode.

```

If you enable the feature to store ConfD’s configuration in CDB as described in Chapter 27.4.2, Storing ConfD configuration parameters in CDB, of the ConfD User Guide, you will be able to retrieve their current values by accessing CDB.

---

<div class="post-metadata">

**Author:** ![Harry\_Huang](https://avatars.discourse-cdn.com/v4/letter/h/a88e57/32.png) [@Harry\_Huang](https://dmap-community.ductus.global/u/Harry_Huang)\
**Post date:** [January 5, 2017, 6:50am UTC](https://dmap-community.ductus.global/t/how-to-get-the-confd-cli-prompt/914/3 "2017-01-05T06:50:09Z")

</div>

Thanks Wai!

I guess what we can get is the prompt format like “\u@\h%”, but I just need the prompt string like “sim\_1rp-ssr1” which is the actual hostname.

Is there any such method can confd provide?

---

<div class="post-metadata">

**Author:** ![waitai](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/waitai/32/436_2.png) [@waitai](https://dmap-community.ductus.global/u/waitai)\
**Post date:** [January 5, 2017, 5:24pm UTC](https://dmap-community.ductus.global/t/how-to-get-the-confd-cli-prompt/914/4 "2017-01-05T17:24:15Z")

</div>

You can get the hostname by using the gethostbyname( ) system call. It is also available in your shell environment as HOSTNAME.

---

<div class="post-metadata">

**Author:** ![Harry\_Huang](https://avatars.discourse-cdn.com/v4/letter/h/a88e57/32.png) [@Harry\_Huang](https://dmap-community.ductus.global/u/Harry_Huang)\
**Post date:** [January 9, 2017, 6:43am UTC](https://dmap-community.ductus.global/t/how-to-get-the-confd-cli-prompt/914/5 "2017-01-09T06:43:24Z")

</div>

Thanks Wai,

Yes, but that will only handle the ‘\h’. ConfD provides a lot more other arguments for prompt.

Especially for prompt2, it will take in the list instance’s key name as part of the prompt.

How can we get the prompt length then?
