Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
XIII
4 years agoSuper Contributor
[46] How can I use a newline character in a field value?
In the past I created some multi-line fields for SSH keys after reading this tip on this forum.
I now want to update one of those keys using op item edit "K" 'private key=X\nY' .
However then ...
Former Member
4 years agoHey XIII ,
While we look into the issue, I've found a temporary workaround in setting field values to contain newlines via the CLI.
I understand my solution is not ideal as it is quite inconvenient, but it may serve you for the time being while we sort things out.
You can set the values into a temporary variable:
export VALUE_WITH_NEWLINES="A\nb\n3"
And interpolate the variable into the op item edit or op item create commands:
op item edit exampeItem "section1.field1[text]=$(echo $VALUE_WITH_NEWLINES)"
By the way, I noticed you wrote "(as before)" in your original post, I am wondering if newlines had worked for you in setting field values in the CLI v1? I ask because I have not been able to do so, for example:
op1 create item login --vault demo --title exampleItem notesPlain="A\nb\n3"
Results in a username field that also contains the raw \n chars instead of newlines.
I share Horia's sentiment - thank you for the feedback!