Team,
looks simple but am unable to catch it. Am trying to read a file from user and store its contents into variable. My echo is working as its printing the file but my cat is not working.
read -p "specify the file to read nodes from: " file
echo $file
file_contents=$(cat $file | awk -F ',' '{print $1}')
for item in $file_contents
do
echo $item
done;
output
$HOME\backup\file.log
no such file
cat $HOME\backup\file.log
expected output
\home\users\backup\file.log
item1
item2
item3
forthere, BTW. See mywiki.wooledge.org/BashFAQ/001