I'd like to put two strings in two different variables. Let's take a small example.

after a simple grep, I got this :

$ grep nl.*acc.*bas :

I'd like to have two variables, one containing ABAS01, and the other containing ABAS02.

How can I do this ? I guess a loop can be used to go through all the results from my query, then I could do a cut -d= -f1 to retrieve the name of the variables.

How can I do this ?


If it's AT&T or zsh implementations of ksh:

cmd | { IFS== read -r var1 x && IFS== read -r var2 x; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.