I am trying to display a string in zenity:
chars="\, /, <, >, ?, |, &, $"
echo $chars
\, /, <, >, ?, |, &, $
Now when I execute:
zenity --forms --text="Chars not allowed: $chars" --add-entry="File Name"
Instead of getting Chars not allowed: \, <, >, ?, |, &, $ I am getting Forms Dialog
What do I do wrong? Also, why is the following work?
zenity --forms --text="Enter File Name" --add-entry="Chars not allowed: $chars"
In the end, I was able to solve this issue by showing an image, if one or more not allowed chars, were inserted.
not_allowed_chars.png - Google Drive
yad --image="$MD5SUM_ICONS/not_allowed_chars.png" --title="" --text "\nOne or more special chars detected...\n\n\t\tProcess aborted." --no-escape --no-buttons --center --fixed
You will need to use markup language for this, and escape backslashes multiple times.
Something like this should work :
chars="\\\\ , /, <, >, ?, |, &, $"
zenity --forms --text="Chars not allowed: $chars" --add-entry="File Name"
Hope that helps
Regards
Peasant
1 Like