Answer the question
In order to leave comments, you need to log in
How does bash understand which variable to operate on?
Good afternoon.
In the process of writing the script, I encountered this moment:
There is a file with text:
1212 | 4956666666 | 0000
#!/bin/bash
cat text | grep $1 | awk -F "|" {'print $1'}
[email protected]:~/sripts$ bash -x ./test 6666
+ cat text
+ grep 6666
+ awk -F '|' '{print $1}'
1212
Answer the question
In order to leave comments, you need to log in
Because the second one is inside single quotes. String inside singles is not interpolated
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question