I am assigning a variable to echo command which generates a random number.
n=$(echo $(( (RANDOM%6) +1)). I have to grep this variable in
So, my syntax reads like:
n=$(echo $(( (RANDOM%6) +1)) | grep "$n" /etc/passwd
But I get the entire file content(
/etc/passwd) as output. I do not know where the syntax is wrong.
It is important I get the output in one line only.