I have a binary foo which requires two command line arguments: username and password.
I have written script.py to generate the username and password. Currently, I am using print to print them to stdout and then manually copy and paste them in the shell when I call foo in shell, i.e.,
(i copied and paste the output below)
$./foo username password
./foo $(python script.py)
To demonstrates that this works and provides
foo with two arguments, let's use this script.py:
$ cat script.py #!/usr/bin/python print("name1 pass1")
And let's use this
foo so that we can see what arguments were provided to it:
$ cat foo #!/bin/sh echo "1=$1 2=$2"
Here is the result of execution:
$ ./foo $(python script.py) 1=name1 2=pass1
As you can see,
foo received the name as its first argument and the password as its second argument.
Security Note: The OP has stated that this is not relevant for his application but, for others who may read this with other applications in mind, be aware that passing a password on a command line is not secure: full command lines are readily available to all users on a system.