Windows Ubuntu Terminal Script not Working
![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
for my bash programming assignment i have to create pipelines to process a file to find some patterns. I am currently using the Windows 10 Ubuntu App terminal. I Wrote the following the following :
echo "Processing Log Files..."
# error is the word I'm looking for in the files
grep error -A 1 logfile1.txt >> filter.txt
grep error -A 1 logfile2.txt >> filter.txt
echo "Done."
But when i run the file with the header #!/bin/sh I get this error:
Processing Log Files...
: Directory nonexistentoder.sh: cannot create filter.txt
: Directory nonexistentoder.sh: cannot create filter.txt
Done.
And when i run the code with the header #!/bin/bash i get this error:
Processing Log Files...
: No such file or directoryer.txt
: No such file or directoryer.txt
Done.
I honestly have no idea of why this happens, i changed the permissions of the files to the following:
drwxrwxrwx 0 root root 512 Mar 20 23:25 .
drwxrwxrwx 0 root root 512 Mar 20 13:59 ..
-rwxrwxrwx 1 root root 316 Mar 20 23:24 decoder.sh
-rwxrwxrwx 1 root root 52247 Mar 19 15:59 logfile1.txt
-rwxrwxrwx 1 root root 33142 Mar 19 15:59 logfile2.txt
-rwxrwxrwx 1 root root 239 Mar 19 15:39 mapping-sorted.txt
command-line bash grep windows-subsystem-for-linux
add a comment |Â
up vote
0
down vote
favorite
for my bash programming assignment i have to create pipelines to process a file to find some patterns. I am currently using the Windows 10 Ubuntu App terminal. I Wrote the following the following :
echo "Processing Log Files..."
# error is the word I'm looking for in the files
grep error -A 1 logfile1.txt >> filter.txt
grep error -A 1 logfile2.txt >> filter.txt
echo "Done."
But when i run the file with the header #!/bin/sh I get this error:
Processing Log Files...
: Directory nonexistentoder.sh: cannot create filter.txt
: Directory nonexistentoder.sh: cannot create filter.txt
Done.
And when i run the code with the header #!/bin/bash i get this error:
Processing Log Files...
: No such file or directoryer.txt
: No such file or directoryer.txt
Done.
I honestly have no idea of why this happens, i changed the permissions of the files to the following:
drwxrwxrwx 0 root root 512 Mar 20 23:25 .
drwxrwxrwx 0 root root 512 Mar 20 13:59 ..
-rwxrwxrwx 1 root root 316 Mar 20 23:24 decoder.sh
-rwxrwxrwx 1 root root 52247 Mar 19 15:59 logfile1.txt
-rwxrwxrwx 1 root root 33142 Mar 19 15:59 logfile2.txt
-rwxrwxrwx 1 root root 239 Mar 19 15:39 mapping-sorted.txt
command-line bash grep windows-subsystem-for-linux
Are you running the script as root or as a user ?
â Panther
Mar 21 at 5:54
1
Whenever you see text smooshed together likedirectoryer.txt
the most likely issue is that the script has been created/saved with Windows line endings (CR/LF rather than plain LF)
â steeldriver
Mar 21 at 5:57
@steeldriver That might be the issue since in edition the files using a windows program, rather than a terminal editor
â Diego Rodriguez
Mar 21 at 6:11
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
for my bash programming assignment i have to create pipelines to process a file to find some patterns. I am currently using the Windows 10 Ubuntu App terminal. I Wrote the following the following :
echo "Processing Log Files..."
# error is the word I'm looking for in the files
grep error -A 1 logfile1.txt >> filter.txt
grep error -A 1 logfile2.txt >> filter.txt
echo "Done."
But when i run the file with the header #!/bin/sh I get this error:
Processing Log Files...
: Directory nonexistentoder.sh: cannot create filter.txt
: Directory nonexistentoder.sh: cannot create filter.txt
Done.
And when i run the code with the header #!/bin/bash i get this error:
Processing Log Files...
: No such file or directoryer.txt
: No such file or directoryer.txt
Done.
I honestly have no idea of why this happens, i changed the permissions of the files to the following:
drwxrwxrwx 0 root root 512 Mar 20 23:25 .
drwxrwxrwx 0 root root 512 Mar 20 13:59 ..
-rwxrwxrwx 1 root root 316 Mar 20 23:24 decoder.sh
-rwxrwxrwx 1 root root 52247 Mar 19 15:59 logfile1.txt
-rwxrwxrwx 1 root root 33142 Mar 19 15:59 logfile2.txt
-rwxrwxrwx 1 root root 239 Mar 19 15:39 mapping-sorted.txt
command-line bash grep windows-subsystem-for-linux
for my bash programming assignment i have to create pipelines to process a file to find some patterns. I am currently using the Windows 10 Ubuntu App terminal. I Wrote the following the following :
echo "Processing Log Files..."
# error is the word I'm looking for in the files
grep error -A 1 logfile1.txt >> filter.txt
grep error -A 1 logfile2.txt >> filter.txt
echo "Done."
But when i run the file with the header #!/bin/sh I get this error:
Processing Log Files...
: Directory nonexistentoder.sh: cannot create filter.txt
: Directory nonexistentoder.sh: cannot create filter.txt
Done.
And when i run the code with the header #!/bin/bash i get this error:
Processing Log Files...
: No such file or directoryer.txt
: No such file or directoryer.txt
Done.
I honestly have no idea of why this happens, i changed the permissions of the files to the following:
drwxrwxrwx 0 root root 512 Mar 20 23:25 .
drwxrwxrwx 0 root root 512 Mar 20 13:59 ..
-rwxrwxrwx 1 root root 316 Mar 20 23:24 decoder.sh
-rwxrwxrwx 1 root root 52247 Mar 19 15:59 logfile1.txt
-rwxrwxrwx 1 root root 33142 Mar 19 15:59 logfile2.txt
-rwxrwxrwx 1 root root 239 Mar 19 15:39 mapping-sorted.txt
command-line bash grep windows-subsystem-for-linux
command-line bash grep windows-subsystem-for-linux
edited Mar 21 at 10:54
Drakonoved
7421515
7421515
asked Mar 21 at 5:46
![](https://lh3.googleusercontent.com/-p3M7QL8QENY/AAAAAAAAAAI/AAAAAAAAAMM/GDp5Sc4CG4M/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-p3M7QL8QENY/AAAAAAAAAAI/AAAAAAAAAMM/GDp5Sc4CG4M/photo.jpg?sz=32)
Diego Rodriguez
211
211
Are you running the script as root or as a user ?
â Panther
Mar 21 at 5:54
1
Whenever you see text smooshed together likedirectoryer.txt
the most likely issue is that the script has been created/saved with Windows line endings (CR/LF rather than plain LF)
â steeldriver
Mar 21 at 5:57
@steeldriver That might be the issue since in edition the files using a windows program, rather than a terminal editor
â Diego Rodriguez
Mar 21 at 6:11
add a comment |Â
Are you running the script as root or as a user ?
â Panther
Mar 21 at 5:54
1
Whenever you see text smooshed together likedirectoryer.txt
the most likely issue is that the script has been created/saved with Windows line endings (CR/LF rather than plain LF)
â steeldriver
Mar 21 at 5:57
@steeldriver That might be the issue since in edition the files using a windows program, rather than a terminal editor
â Diego Rodriguez
Mar 21 at 6:11
Are you running the script as root or as a user ?
â Panther
Mar 21 at 5:54
Are you running the script as root or as a user ?
â Panther
Mar 21 at 5:54
1
1
Whenever you see text smooshed together like
directoryer.txt
the most likely issue is that the script has been created/saved with Windows line endings (CR/LF rather than plain LF)â steeldriver
Mar 21 at 5:57
Whenever you see text smooshed together like
directoryer.txt
the most likely issue is that the script has been created/saved with Windows line endings (CR/LF rather than plain LF)â steeldriver
Mar 21 at 5:57
@steeldriver That might be the issue since in edition the files using a windows program, rather than a terminal editor
â Diego Rodriguez
Mar 21 at 6:11
@steeldriver That might be the issue since in edition the files using a windows program, rather than a terminal editor
â Diego Rodriguez
Mar 21 at 6:11
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
Thanks to @steeldriver I found out that the script i wrote had hidden windows characters, since i was using a windows text editor. I ran the following line, and the file had the header #!/bin/bash.
dos2unix scriptName.sh
the script worked afterwards :D
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Thanks to @steeldriver I found out that the script i wrote had hidden windows characters, since i was using a windows text editor. I ran the following line, and the file had the header #!/bin/bash.
dos2unix scriptName.sh
the script worked afterwards :D
add a comment |Â
up vote
2
down vote
Thanks to @steeldriver I found out that the script i wrote had hidden windows characters, since i was using a windows text editor. I ran the following line, and the file had the header #!/bin/bash.
dos2unix scriptName.sh
the script worked afterwards :D
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Thanks to @steeldriver I found out that the script i wrote had hidden windows characters, since i was using a windows text editor. I ran the following line, and the file had the header #!/bin/bash.
dos2unix scriptName.sh
the script worked afterwards :D
Thanks to @steeldriver I found out that the script i wrote had hidden windows characters, since i was using a windows text editor. I ran the following line, and the file had the header #!/bin/bash.
dos2unix scriptName.sh
the script worked afterwards :D
answered Mar 21 at 6:24
![](https://lh3.googleusercontent.com/-p3M7QL8QENY/AAAAAAAAAAI/AAAAAAAAAMM/GDp5Sc4CG4M/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-p3M7QL8QENY/AAAAAAAAAAI/AAAAAAAAAMM/GDp5Sc4CG4M/photo.jpg?sz=32)
Diego Rodriguez
211
211
add a comment |Â
add a comment |Â
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%2f1017829%2fwindows-ubuntu-terminal-script-not-working%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
Are you running the script as root or as a user ?
â Panther
Mar 21 at 5:54
1
Whenever you see text smooshed together like
directoryer.txt
the most likely issue is that the script has been created/saved with Windows line endings (CR/LF rather than plain LF)â steeldriver
Mar 21 at 5:57
@steeldriver That might be the issue since in edition the files using a windows program, rather than a terminal editor
â Diego Rodriguez
Mar 21 at 6:11