I want to create a package manager for LFS (Linux From Scratch) my idea was to use a Python script to ask for the file and transfer the value to a Bash script but so far I can't transfer the value here's my code
import os
import subprocess
path="/sources/"
inputfile=input("please enter input file:")
inputfile1=inputfile
subprocess.call(['bash', 'run.sh', 'inputfile1'])
and here is the Bash script (it's quite short because it's just a test)
path="hello world"
echo $path
echo $inputfile1
Try the following:
inputfile=input("please enter input file:")
subprocess.call(['bash', 'run.sh', inputfile])
If you want to get the output, run: subprocess.check_output(['bash', 'run.sh', inputfile])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.