bashdebianzenity

How To Saving Zenity List Output With Its Separator?


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

Solution

  • try with echo -e :

    echo -e "$VAR" >> output