1

I have a simple list window in zenity with some options to choose in a simple shell scripting as showing below :

#!/bin/bash
VAR=$(zenity --list --multiple --separator="\n" --column="col.1"  --column="col.2" FALSE "option 1" FALSE "option 2" FALSE "option3" --checklist)
echo $VAR >> output

and when i choose a multiple options, the output file contents is:

option 1 option 2

so, how can i save the output of the resulting script with the \n separator like this:

option 1 
option 2
Hayder Ctee
  • 145
  • 9

2 Answers2

1

try with echo -e :

echo -e "$VAR" >> output
nullPointer
  • 4,419
  • 1
  • 15
  • 27
1

For better explanation of how double quotes on bash variable is parsed see the link to earlier responses on similar subject

Capturing multiple line output into a Bash variable

ravi
  • 131
  • 1
  • 8