Thursday, October 30, 2014

Assigning to a variable from a pipe in Z Shell

Unfortunately or sadly, this could not be done by me for my use case in Bash. I'm looking for a good solution in Bash too. Just to note here. To read from the pipe you just have to use the Read command. It only works this way in Zsh so far.
blkid $dev | sed -n 's/.*UUID=\"\([^\"]*\)\".*/\1/p' | read var;
Now you can easily use that $var in that scope like
echo $var

No comments:

Post a Comment

Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...