I did a small test to echo everything in my .txt named portal.When writing in terminal I want the script to echo all with the name entered but I only show the first variable.
input=$1 for portal in $(grep $input /etc/portals | sed '/^#/ d' | awk '{print $1, $2}'); do echo -e "\e[1;32m "$portal" \e[0m"; exit 0 doneelse echo -e "\e[1;31m --> Wrong Input <-- \e[0m" exit 1 donefi
=============
The code works but only $1 gets printed and not the $2.IF I change the code to : awk '{print $1 $2}' then the output is $1$2 with no tab or spacing between variables. =================================
How can I separate the variables so the echo is shown :
test1 [tab/space] test2