0

I am going to put this out there first, this is my shell script homework. However, I am finished with my work. It is just not running properly for some reason. I already asked 2 game developer graduates and a few peers and no one could figure out why is this not working! What is wrong?

Multiple lines without semi-colon

-bash-3.2$ chmod u+x names
-bash-3.2$ cat names
grep 94112 famous.dat | cut -c6-19 > famous.last3
grep 94112 famous.dat | cut -c21-35 > famous.first3
paste famous.first3 famous.last3
rm famous.first3
rm famous.last3
-bash-3.2$ names
paste: famous.first3 : Cannot open the file.
-bash-3.2$

Semi-colon with everything in one line

-bash-3.2$ cat names 
grep 94112 famous.dat | cut -c6-19 > famous.last3; grep 94112 famous.dat | cut -c21-35 > famous.first3; paste famous.first3 famous.last3; rm famous.first3; rm famous.last3;
-bash-3.2$ names
nina            simone        
bob             marley        
michael         franti        
keith           richards      
: command not found
-bash-3.2$

Semi-color with multiple lines

-bash-3.2$ cat names
grep 94112 famous.dat | cut -c6-19 > famous.last3; 
grep 94112 famous.dat | cut -c21-35 > famous.first3; 
paste famous.first3 famous.last3; 
rm famous.first3; 
rm famous.last3;
-bash-3.2$ names
: command not found
: command not found
nina            simone        
bob             marley        
michael         franti        
keith           richards      
: command not found
: command not found
: command not found
-bash-3.2$

Attempt to use dos2unix:

-bash-3.2$ dos2unix names namesunix
-bash: dos2unix: command not found
Strawberry
  • 1,112
  • 4
  • 15
  • 27

1 Answers1

1

Line endings. Try dos2unix.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84