Wednesday, November 16, 2016

Assigning to a variable from a pipe in Z Shell

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. Im 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


Go to link download