I saw a lot of posts about it all over the internet but i couldn't make it run as i wanted.
I have an input from the user of a path. If the user will type ~/Desktop/ for example i can't use $ans in grep and other commands because of the tilde.
here is an example of my code. the second line is my main problem right now.
read -p "Enter new path or type 'exit': " ans
file=`grep -x $ans ~/.Log`
Appreciate your help.
tilde
and not the-x
option togrep
?file=$(grep -x "$ans" ~/.Log); echo "$file"
. Also running your little script usingbash -xv yourscript
what output do you get?