Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
用户输入变量($userinput)可以与一个值进行比较吗?
awk -F: '$1 < $userinput { printf .... }'
这个比较表达式对我来说似乎没问题,但它给出了一个错误?
尝试这样做:
awk -vuserinput="$userinput" -F: '$1 < userinput {}'
一个真实的例子:
read -p "Give me an integer >>> " int awk -v input=$int '$1 < input {print $1, "is less than", input}' <<< 1