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.

Get run command from stdout

See original GitHub issue

Hi, I’m often running multiple commands in dvc run, which can be done by wrapping the command in quotes:

dvc run -d in.txt -o out.txt 'cp in.txt out.txt; for i in {1..10}; do echo ${i} >> out.txt; done'
# Running command:
# 	cp in.txt out.txt; for i in {1..10}; do echo ${i} >> out.txt; done

It would be nice if I could input the command using stdout prompt instead, e.g. by running:

dvc run -d in.txt -o out.txt --interactive
# > Enter command:
cp in.txt out.txt; for i in {1..10}; do echo ${i} >> out.txt; done
# Running command:
# 	cp in.txt out.txt; for i in {1..10}; do echo ${i} >> out.txt; done

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Dec 5, 2018

In your example you are lucky because you didn’t specify -d option last before your command. If you would to do that, there would be no way for a parser to distinguish between where the deps end and where the commands starts.

Indeed, @efiop , introducing a --cmd flag or handling -- correctly to stop the parser could work, however, I wasn’t taking into account Windows users (maybe globbing wouldn’t work the same way), so it would be nice to have some agnostic / non-shell dependent way to handle this 👍

0reactions
efiopcommented, Dec 31, 2018

Looks like we could close this. Please feel free to reopen, if I’ve missed something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to execute the output of a command within the current ...
I pipe whatever I got to sh and it runs it. My problem is, that means starting a new sub shell. I'd rather...
Read more >
Execute stdout results - command line - Unix Stack Exchange
Try doing this : printf '%s\n' /usr/bin/* | while IFS= read -r cmd; do "$cmd" --version; done.
Read more >
Ubuntu: Run the output of another command - Super User
I would like to have a single command line execution that will run commandlineB with the given parameter(s). Is there any simple way...
Read more >
How to redirect shell command output | Enable Sysadmin
How to redirect shell output · 1. Redirect STDOUT · 2. Redirect STDERR · 3. Send STDOUT and STDERR to the same file...
Read more >
How to execute external commands and use their STDOUT in ...
Use the !! method to execute the command and get the standard output from the resulting process as a String . Just like...
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