Comments (6)
What weird behaviour are you seeing? Empty lines?
If so, try:
cargo run 'echo $ITEM' --for "`cat README.md`"
from loop.
Yes, I was seeing empty lines, but that fixed it. Why does the type of quote matter?
from loop.
That's because of your shell, probably bash.
Try echo "$TERM"
and then echo '$TERM'
You'll see that the first time it outputs the value of $TERM, but the second time it outputs a literal $TERM. Double quotes allow variable substitution, single quotes prohibit.
Specifically, when you execute cargo run, the $ITEM is replaced with the value of $ITEM in the parent shell of cargo, aka, the current shell you're in, instead of the shell that loop spins up. $ITEM is most likely empty there.
The same goes for the value of `cat README.md`. This last one doesn't cause a problem though, since both outside loop and inside loop, `cat README.md` would have the same output.
Does that make sense?
from loop.
For more info, see for instance http://wiki.bash-hackers.org/syntax/quoting
mind you, this also goes with other advanced shell like ksh.
from loop.
Ha! Okay, thanks for explaining! I learned something new today.
from loop.
Looks like this can be closed?
from loop.
Related Issues (20)
- If multiple non-option arguments are passed, treat them as a command HOT 6
- offset and count-by are not working as expected. HOT 2
- Make and Distribute Debian Package HOT 12
- Compilation errors in Debian 9 HOT 1
- Normalize Usage in Readme
- stdin Broken HOT 1
- Floating Point Issues When Counting By Floats
- Duration/Until Time Appears To Have An Extra First Iteration
- How to pass through stdout? HOT 5
- Parallel execution HOT 4
- cat items | loop -- echo $ITEM broken?
- v0.6.1 on crates.io fails to compile HOT 6
- --until-changes and --until-same have the same documentation
- Error codes in summary are reported as negative numbers
- Continuous output during execution and refactoring HOT 2
- Could not compile `loop-rs`
- Please create a release and release tag
- Errors running `cargo test`
- Exponential Backoff HOT 1
- Maintainer Needed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loop.