question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to combine multiple command in one script ?

See original GitHub issue

In the scripts field of Pipfile, we can define some scripts and run them by pipenv run <script-name>.

How to combine multiple commands in one script? It seems that the common commands separator (like &&) does not work.

E.g.

[scripts]
test = "python --version && python --help"

After pipenv run test, only the python --version runs, and the && python --help seems to be treated as args.

In addition, commands in array could be better, but seems not available now:

[scripts]
test = [
  "python --version",
  "python --help"
]

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
noirbizarrecommented, May 27, 2022

Just sharing my workaround until we have a builtin solution: && and || are not processed correctly, but this is working if wrapped into sh -c "".

As example, to call all linters

lint = """sh -c "
    isort --check mypackage \
    && black --check mypackage \
    && flake8 mypackage \
    && mypy mypackage \
"
"""

A bit ugly but at least it’s working.

1reaction
adrianohrlcommented, Feb 12, 2020

I’m also having this problem. For example,

[scripts]
chenv = [
    "git update-index --no-assume-unchanged .env",
    "git add -f .env",
    "git commit -m 'updated the .env file'",
    "git update-index --assume-unchanged .env"
]

Which would be used as:

# removed local envs
pipenv run chenv # to update the .env file version which only the global envs

Unfortunately, the && symbol is not working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combine and Execute Multiple Linux Commands - Baeldung
In this tutorial, we'll see the different ways in which we can combine and execute multiple Linux commands efficiently.
Read more >
How to Run Two or More Terminal Commands at Once in Linux
You can combine multiple operators on the command line, too. For example, we want to first check if a file exists ( [...
Read more >
How to Run Multiple Commands in Linux at Once - MakeUseOf
On Linux, there are three ways to run multiple commands in a terminal: ... Combining Multiple Operators to Meet Your Execution Criteria.
Read more >
Execute combine multiple Linux commands in one line
If you want to execute each command only if the previous one succeeded, then combine them using the && operator:
Read more >
bash - Combine two commands into a single command
This may contain spaces, just make sure to enclose it in quotes when you run the script. The double quotes around $1 in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found