In a script (Say myScript.ksh) I have a variable which contains path to a file.
file=/home/vikas/input.ksh
in my code a need something from that file so I am doing a normal cat and grep on this file by doing something like this
myVariable=`cat $file | grep "on this line" | cut -d"'" -f2`
Now everytime I launch myScript.ksh, I get a error
cat: cannot open /home/vikas/input.ksh
But if I do same thing direcly on terminal I am able to see content of the file input.ksh
I dont know what I am doing wrong, can somebody please help me ?
yeah finally the problem solved, though I found the solution weired and could not understand why it worked. Actually I was reading this variable from some other file and it was something like this
the problem was with $HOME what I did I removed $HOME from variable file and added that again by doing this
and after that I did the cat $file and it worked