I have been having issues changing directories using a shell script in windows 10.
In notepad I created a file, test.sh, which has the following script:
#!/bin/bash
cd '/mnt/p/WMScriptTest/'
I then mounted the Ubuntu terminal to the location of the test.sh file by typing in cd /mnt/p/
which works. Next, I typed in ./test.sh
and keep getting the following error message:
: No such file or directory/p/WMScriptTest/
I am new to using ubuntu and any help/suggestions are greatly appreciated. Thank you
ls -l /mnt/p
. In a script one normally doesn’t usecd
, but rather absolute paths. You can store paths in variables if that makes it easier, e.g.mypath=/mnt/p/WMScriptTest
and thenmkdir "$mypath/mydir"
andcp "$mypath/file1" "$mypath/mydir"
.: No such file or directory/p/WMScriptTest/
? That looks mangled somehow…