Comments (4)
It might? Neither the man page nor the --help output explain what it does (what's shell-format). envsubst -v PATH didn't print anything, and envsubst -v '$PATH' printed PATH...
So it's basically you want something like:
$ echo '$SHLVL/$DISPLAY' | eval
1/:0.0
Except as a standalone shell command? I mean, I suppose I could do it as a shell builtin instead of a shell function. Not entirely sure WHY, but... sure?
Have you tried asking Chet the bash maintainer if he thinks there's already a way to do this built in to bash? Seems like there should be somewhere, a trivial shell function with some sort of ${1@Q} or declare corner case...
from toybox.
And you want a safe command that's not gonna $(subshell) and so on.
Writing it seems trivial, especially if I can leverage the code I already wrote for toysh. Working out what the specification actually IS, not so much.
from toybox.
Here is the man page: https://man7.org/linux/man-pages/man1/envsubst.1.html and some examples https://www.baeldung.com/linux/envsubst-command
It is a utility by itself, not a shell builtin.
eg:
https://pkgs.alpinelinux.org/package/edge/testing/x86_64/envsubst
https://github.com/a8m/envsubst
from toybox.
That would be the man page I mentioned not finding particularly enlightening, yes. The examples are helpful though, thanks. (I never would have guessed that shell-format was INSANE enough to need the $ on the variable name to be substituted.)
I'm aware it's a standalone command, most external packages are, I'm just saying it would be easier for me to implement it as a shell builtin because the shell already has variable resolution plumbing including the various ${name/search/replace} that kaniini/envsubst#1 has an open issue for (I'd more or less get that for free).
However, they presumably want it NOT to run $(subshell) and so on for security reasons, which doesn't sound hard to block but I'd want to think about the design a bit to be sure.
As for having a shell builtin that's also available as a standalone command in the $PATH... well that's kind of what TOYFLAG_MAYFORK does, except sort of in reverse here. (The tricksy part is that scripts/single.sh special cases sh for standalone builds and I'd need to categorize this properly. This command wants to use the shell plumbing, but without the shell builtin variables like $OLDPWD and $RANDOM because echo '$RANDOM' | env -i envsubst doesn't print them. Possibly some chunk of code should get factored out...)
from toybox.
Related Issues (20)
- Request diff -I/--ignore-matching-lines
- [Documentation] Differences to busybox? HOT 3
- [Feature request] Could a static-option be added to the menu interface? HOT 5
- [Documentation / Question] Can toybox be combined with e. g. mruby? HOT 9
- building a rootfs without a kernel HOT 10
- Most scripts use /bin/bash, which not all systems have. Use /usr/bin/env instead? HOT 11
- [Q] Can `bash` compatibility in toysh be turned off during build time and during run time? HOT 2
- building 0.8.11 with ssl and tls is broken HOT 15
- When running shell scripts, the process coredump.
- POSIX deviation: test arithmetic operands must support decimal only HOT 12
- find -size <number-without-suffix> not POSIX HOT 7
- Can you include oksh? HOT 1
- On incremental builds' reproducibility HOT 1
- ASAN failures in various file processing commands HOT 2
- [Feature Suggestion] progress meter (pv subcommand) HOT 5
- getty: does not display issue HOT 1
- command unshare broken HOT 1
- tar honor umask test fails on Android HOT 4
- Building Toybox for J2 Turtleboard fails since 650ff11a
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 toybox.