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 /usr/include/linux/a.out.h
).
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?.
Update
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
--textbox file height width
work or do you need the user to agree to a large amount of text? Or what?--max-input size Limit input strings to the given size. If not specified, the limit is 2048.
. I don't know if there is a limit for Bash. I've certainly never hit it.--textbox
takes a file as an argument. Have you tried putting the arguments in a file?The "--file" option tells dialog to read parameters from the file named as its value. dialog --file parameterfile