The problem is more apparent than it looks. There is no non-printable character.
Let's take a look a cd
error message from dash
, the shell you're using instead of bash
:
$ cd somewhere
dash: 5: cd: can't cd to somewhere
^-- Nothing follows the path
Now look at your error message:
mvrec.sh: 5: cd: can't cd to /home/sandilya/part655gib/recup_dir.5:
Spurious colon ---^
And where does this colon come from?
for i in `readlink -f rec*`:
^--- Right here
Delete it, and it'll work.
(Note that this is not canonical or entirely correct code, and people's suggestions about for f in rec*
loops and subshells still apply.)