How to use output of a command as input for an executable file

Hello guys
Is it possible to send the result of a command (or a chain of
commands) as input to an executable file in one command?
For example:

./formatfs.sh < ls -l /dev/* | grep sdb1

Where i want to send the file /dev/sdb1 to the executable to be formatted.

./formatfs.sh $( ls -l /dev* | grep sdb1 )

1 Like

Thanks for the help…

Please note that

./formatfs.sh $( ls -l /dev* | grep sdb1 )

will only work if you’re using $1 (first parameter that is passed to the script) as argument somewhere in the script itself. Otherwise, it won’t work.

Okay got that…