Sometimes it happens that I have a list of files or strings in the clipboard and want to paste it as an argument list in a bash shell:Example file list (only an example):createsnapshot.shdirectorylisting.shfetchfile.shWhat I want:md5sum createsnapshot.sh directorylisting.sh fetchfile.shCurrently, I enter the following hacky command line (the filenames are pasted from clipboard; the list can contain dozens of lines):md5sum $(echo $(echo createsnapshot.shdirectorylisting.shfetchfile.sh))This has several disadvantages:it's complexit doesn't look wellit doesn't support lines which contain spacesWhat other options do I have? md5sum  doesn't work because in this case I get only one argument with a multi-line string. Similar with here-documents.It's not always md5sum. It can also be tar or git add or du -hsc. I don't just ask for a way to get the md5 checksums of these files. Such situations occur about 2-5 times a day.
Interactively add arguments line-by-line in bash
bash;shell;command line;clipboard
If the commands don't use stdin, use xargs, which reads input and translates it to arguments (note that I am using the echo command to show how xargs builds the command):$ xargs echo md5sum# paste textcreatesnapshot.shdirectorylisting.shfetchfile.sh# press Ctrl-D to signify end of inputmd5sum createsnapshot.sh directorylisting.sh fetchfile.shUsing xargs with -d '\n', so that each line is taken as a complete argument, spaces notwithstanding:$ xargs -d'\n' md5sum# pastea file with spacesafilewithoutspacesfoo   bar# Ctrl Dmd5sum: a file with spaces: No such file or directorymd5sum: afilewithoutspaces: No such file or directorymd5sum: foo   bar: No such file or directoryAs you can see, md5sum prints errors for each filename, irrespective of the other whitespace in the filenames.If you're willing to use xclip, then you can pipe or otherwise feed it to xargs:xargs -a <(xclip -o) -d '\n' md5sumxclip -o | xargs -d '\n' md5sumThis should reliably work with filenames with spaces.