Looking at the man page for this there does seem to be any way to avoid passing the text as an argument - there appears to be no way to pipe the data in or have
dialog read directly from the file. However, you could limit the size of the argument using
head. On most Linux systems the maximum size for a single argument is 32KiB, so you could do:
dialog --max-input 32768 --yesno "$(head -c 32K FILE)" 10 100
The maximum size for a single argument is defined by
MAX_ARG_STRLEN which you will find in
/usr/include/linux/binfmts.h if you have kernel headers installed. Usually the value is
PAGE_SIZE * 32 where
PAGE_SIZE is usually 1KiB (see
Of course these values can be completely reconfigured. Moreover
MAX_ARG_STRLEN is Linux specific and was introduced in Linux 2.6.23. For more information about what the limits actually are, please see What defines the maximum size for a command single argument?.
Oops, you can actually use the
--file argument for this. It looks like you can do something like (without having tested):
echo -n \"
sed 's/"/\"/' FILE
echo -n \"
} | dialog --yesno --file '&1' 10 100
No need for the
sed if you know there are no quotes in the file. Or alternatively just put everything you need in the file (quotes,
--yesno and all) and simply do:
dialog --file FILE