Answer the question
In order to leave comments, you need to log in
How to write a bash script that will run a file that supports command line arguments?
I have get-movies.py file.
I can call it like this: python3 get-movies.py
.
This file supports 5 arguments:
-year_from (if the argument is not written after the file name, then it defaults to 1800)
-year_to (if the argument is not written after the file name, then it defaults to 2030)
-N (if the argument is not written after the file name then it defaults to None)
-regexp (if the argument is not written after the file name, then it defaults to '')
-genres (if the argument is not written after the file name, then it defaults to '')
I don't know how important this is, but in parentheses above indicated the values that they take in the file by default.
That is, I can run this file in the terminal by writing these arguments after the file name, for example:
python3 get-movies.py -year_from 2005 -regexp 'Terminator' -genres 'Action' -N 3
python3 get-movies.py -N 3 -regexp 'Terminator'
python3 get-movies.py -genres 'Comedy' -N 3
file.sh -N 3 -regexp 'Terminator'
, then this file.sh should run get-movies.py inside itself with the same parameters, that is, it should do this inside itself: python3 get-movies.py -N 3 -regexp 'Terminator'
Answer the question
In order to leave comments, you need to log in
#!/bin/bash
python3 get-movies.py "[email protected]"
#!/usr/bin/env python3
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question