No such file or directory when changing directory: Running shell script in ubuntu in windows 10
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
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
command-line bash scripts windows-10 windows-subsystem-for-linux
 |Â
show 7 more comments
up vote
0
down vote
favorite
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
command-line bash scripts windows-10 windows-subsystem-for-linux
Please edit and add the output ofls -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"
.
â dessert
Jun 4 at 18:08
I just seem to be unable to change directories from code in my shell script. One of the folders listed from ls -l /mnt/p/ is WMScriptTest that I am trying to change directories to. If I change directories within the terminal itself it works though.
â Justin S.
Jun 4 at 18:44
Is the error message really (literally): No such file or directory/p/WMScriptTest/
? That looks mangled somehowâ¦
â dessert
Jun 4 at 18:46
Yes, that is the exact message that I get
â Justin S.
Jun 4 at 18:47
2
Maybe a problem with line endings? askubuntu.com/q/803162/507051
â dessert
Jun 4 at 18:48
 |Â
show 7 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
command-line bash scripts windows-10 windows-subsystem-for-linux
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
command-line bash scripts windows-10 windows-subsystem-for-linux
edited Jun 4 at 18:01
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
dessert
19.4k55494
19.4k55494
asked Jun 4 at 17:58
Justin S.
1
1
Please edit and add the output ofls -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"
.
â dessert
Jun 4 at 18:08
I just seem to be unable to change directories from code in my shell script. One of the folders listed from ls -l /mnt/p/ is WMScriptTest that I am trying to change directories to. If I change directories within the terminal itself it works though.
â Justin S.
Jun 4 at 18:44
Is the error message really (literally): No such file or directory/p/WMScriptTest/
? That looks mangled somehowâ¦
â dessert
Jun 4 at 18:46
Yes, that is the exact message that I get
â Justin S.
Jun 4 at 18:47
2
Maybe a problem with line endings? askubuntu.com/q/803162/507051
â dessert
Jun 4 at 18:48
 |Â
show 7 more comments
Please edit and add the output ofls -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"
.
â dessert
Jun 4 at 18:08
I just seem to be unable to change directories from code in my shell script. One of the folders listed from ls -l /mnt/p/ is WMScriptTest that I am trying to change directories to. If I change directories within the terminal itself it works though.
â Justin S.
Jun 4 at 18:44
Is the error message really (literally): No such file or directory/p/WMScriptTest/
? That looks mangled somehowâ¦
â dessert
Jun 4 at 18:46
Yes, that is the exact message that I get
â Justin S.
Jun 4 at 18:47
2
Maybe a problem with line endings? askubuntu.com/q/803162/507051
â dessert
Jun 4 at 18:48
Please edit and add the output of
ls -l /mnt/p
. In a script one normally doesnâÂÂt use cd
, but rather absolute paths. You can store paths in variables if that makes it easier, e.g. mypath=/mnt/p/WMScriptTest
and then mkdir "$mypath/mydir"
and cp "$mypath/file1" "$mypath/mydir"
.â dessert
Jun 4 at 18:08
Please edit and add the output of
ls -l /mnt/p
. In a script one normally doesnâÂÂt use cd
, but rather absolute paths. You can store paths in variables if that makes it easier, e.g. mypath=/mnt/p/WMScriptTest
and then mkdir "$mypath/mydir"
and cp "$mypath/file1" "$mypath/mydir"
.â dessert
Jun 4 at 18:08
I just seem to be unable to change directories from code in my shell script. One of the folders listed from ls -l /mnt/p/ is WMScriptTest that I am trying to change directories to. If I change directories within the terminal itself it works though.
â Justin S.
Jun 4 at 18:44
I just seem to be unable to change directories from code in my shell script. One of the folders listed from ls -l /mnt/p/ is WMScriptTest that I am trying to change directories to. If I change directories within the terminal itself it works though.
â Justin S.
Jun 4 at 18:44
Is the error message really (literally)
: No such file or directory/p/WMScriptTest/
? That looks mangled somehowâ¦â dessert
Jun 4 at 18:46
Is the error message really (literally)
: No such file or directory/p/WMScriptTest/
? That looks mangled somehowâ¦â dessert
Jun 4 at 18:46
Yes, that is the exact message that I get
â Justin S.
Jun 4 at 18:47
Yes, that is the exact message that I get
â Justin S.
Jun 4 at 18:47
2
2
Maybe a problem with line endings? askubuntu.com/q/803162/507051
â dessert
Jun 4 at 18:48
Maybe a problem with line endings? askubuntu.com/q/803162/507051
â dessert
Jun 4 at 18:48
 |Â
show 7 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1043569%2fno-such-file-or-directory-when-changing-directory-running-shell-script-in-ubunt%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Please edit and add the output of
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"
.â dessert
Jun 4 at 18:08
I just seem to be unable to change directories from code in my shell script. One of the folders listed from ls -l /mnt/p/ is WMScriptTest that I am trying to change directories to. If I change directories within the terminal itself it works though.
â Justin S.
Jun 4 at 18:44
Is the error message really (literally)
: No such file or directory/p/WMScriptTest/
? That looks mangled somehowâ¦â dessert
Jun 4 at 18:46
Yes, that is the exact message that I get
â Justin S.
Jun 4 at 18:47
2
Maybe a problem with line endings? askubuntu.com/q/803162/507051
â dessert
Jun 4 at 18:48