Quantcast
Channel: Can command substitution be nested in variable substitution? - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 6 View Live

Answer by Paul Elliott for Can command substitution be nested in variable...

On Linux, you can pipe into the source command:echo $(xclip -o -selection clipboard)/copi/knott|source /dev/stdinFor systems that do not have /dev/stdin, you would have to write toa temporary file,...

View Article


Answer by fozzybear for Can command substitution be nested in variable...

Here's an examplary hack, that bypasses assigning a temporary variable for chained parameter substitution:declare -a values=( "4: " "#1" "#2" "#3" "#4" )declare -A arr["VALUES"]="${values[@]}"echo -e...

View Article

Answer by mikeserv for Can command substitution be nested in variable...

Yeah, you can do that - kind of. It's really not pretty. It's more like in-line than nested. The problem is you have to operate on the value of the parameter you expand - if that parameter has no value...

View Article

Answer by cuonglm for Can command substitution be nested in variable...

No, you can't. bash and most other shells (except zsh) don't allow nested substitution.With zsh, you can do nested substitution:$ echo ${$(echo 123)/123/456} 456

View Article

Answer by John1024 for Can command substitution be nested in variable...

If you don't want to create a variable, then there are other ways to perform string substitution:$ echo "$(xclip -o -selection clipboard | sed 's/copi/knott/')"Here's a string I just knotted.

View Article


Can command substitution be nested in variable substitution?

I would like to use variable substitution on a particular string that I access via a command. For example, if I copy something into my clipboard, I can access it like this.$ xclip -o -selection...

View Article
Browsing latest articles
Browse All 6 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>