Artificial intelligent assistant

Bash capturing asterisk inside a file I have a text file which contains an asterisk as the first character in every line, when I try to process the file in a script like this: while read line; do out=$(echo $line | awk '{ print $3 }') echo $out done < file_with_asterisks It is printing the files in the current working directory, not the 3rd column as I want. Removing the asterisk solves the problem, so I figured out it was doing globbing. How do I make bash take the asterisk as text and not a wildcard?

You should put quotes around your variables:


while IFS= read -r line; do
out=$(echo "$line" | awk '{ print $3 }')
echo "$out"
done < file_with_asterisks


In your case the `echo $line` expands (I am assuming a space follows the initial asterisks on each line)

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2ccfba461db6f60523f7d81817e8f5d6