# Dfx encode principal

**URL:** <https://forum.dfinity.org/t/dfx-encode-principal/18376>\
**Category:** Developers\
**Created:** [February 4, 2023, 1:34pm UTC](https://forum.dfinity.org/t/dfx-encode-principal/18376 "2023-02-04T13:34:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [February 4, 2023, 5:00pm UTC](https://forum.dfinity.org/t/dfx-encode-principal/18376/3 "2023-02-04T17:00:41Z")

</div>

> [@paulyoung](#):
>
> Most likely related to Bash not expanding variables between single quotes.
> 
> `echo '(record {manager = principal"'${MANAGER}'";})'` should reveal the string you’re providing and allow you to experiment.

Thanks! @nmattia literally just helped me debug this (not all heroes wear capes) and while we did not find the solution, he found a workaround by encoding the argument in `raw`

```auto
#!/usr/bin/env bash

MANAGER=$(dfx identity get-principal)

dfx deploy console --argument "$(didc encode '(record {manager = principal"'${MANAGER}'";})' --format hex)" --argument-type raw

```

and making the argument mandatory

```auto
let call_arg = arg_data::<(ConsoleArgs,)>().0;
let manager = call_arg.manager;

```

> [@paulyoung](#):
>
> For what it’s worth; if you always want the manager to be the caller, I think you can remove the argument and use `ic_cdk::caller()` instead.

Oh that’s a good idea 👍

---

_[View the full topic](https://forum.dfinity.org/t/dfx-encode-principal/18376)._
